473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Click in Image to open Link?

Hello,

i have an image with the following code:
<img src="image/panel.gif" width="20" height="80"
onClick="fnLoadNewWindow('http://www.google.com');">

When i click the image the Javascript Function fnLoadNewWindow opens a new
window with google.com.

The problem is that the mouse doesn't change when it's over the image to the
icon that usually shows when the image is a link.

What am i doing wrong here?

Thank You,
Miguel

P.S: The function works fine. A new windows is opened when i click the
image.
Nov 18 '05 #1
5 6005
Hi Miguel,

An ASP.NET Imagebutton control would give you the effect you want:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
ImageButton1.Attributes.Add _
("onclick", _
"window.open('http://www.google.com',null," & _
"'height=200,width=400," & _
"status=yes,toolbar=no,menubar=no," & _
"location=no');return false;")
End Sub
<form id="Form1" method="post" runat="server">
<asp:ImageButton id="ImageButton1" runat="server"
ImageUrl="http://www.google.ca/intl/fr_ca/images/logo.gif"></asp:ImageButton>
</form>

Ken
Microsoft MVP [ASP.NET]
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:e$**************@tk2msftngp13.phx.gbl...
Hello,

i have an image with the following code:
<img src="image/panel.gif" width="20" height="80"
onClick="fnLoadNewWindow('http://www.google.com');">

When i click the image the Javascript Function fnLoadNewWindow opens a new
window with google.com.

The problem is that the mouse doesn't change when it's over the image to
the
icon that usually shows when the image is a link.

What am i doing wrong here?

Thank You,
Miguel

P.S: The function works fine. A new windows is opened when i click the
image.


Nov 18 '05 #2
style="cursor:'hand';"
--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:e$**************@tk2msftngp13.phx.gbl...
Hello,

i have an image with the following code:
<img src="image/panel.gif" width="20" height="80"
onClick="fnLoadNewWindow('http://www.google.com');">

When i click the image the Javascript Function fnLoadNewWindow opens a new
window with google.com.

The problem is that the mouse doesn't change when it's over the image to the icon that usually shows when the image is a link.

What am i doing wrong here?

Thank You,
Miguel

P.S: The function works fine. A new windows is opened when i click the
image.

Nov 18 '05 #3
There is a problem. I allready have a form in this page. Can i have 2 forms
in the same page?

I am asking this because i got an error.

Miguel

"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:Oa**************@tk2msftngp13.phx.gbl...
Hi Miguel,

An ASP.NET Imagebutton control would give you the effect you want:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
ImageButton1.Attributes.Add _
("onclick", _
"window.open('http://www.google.com',null," & _
"'height=200,width=400," & _
"status=yes,toolbar=no,menubar=no," & _
"location=no');return false;")
End Sub
<form id="Form1" method="post" runat="server">
<asp:ImageButton id="ImageButton1" runat="server"
ImageUrl="http://www.google.ca/intl/fr_ca/images/logo.gif"></asp:ImageButton
</form>

Ken
Microsoft MVP [ASP.NET]
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:e$**************@tk2msftngp13.phx.gbl...
Hello,

i have an image with the following code:
<img src="image/panel.gif" width="20" height="80"
onClick="fnLoadNewWindow('http://www.google.com');">

When i click the image the Javascript Function fnLoadNewWindow opens a new window with google.com.

The problem is that the mouse doesn't change when it's over the image to
the
icon that usually shows when the image is a link.

What am i doing wrong here?

Thank You,
Miguel

P.S: The function works fine. A new windows is opened when i click the
image.

Nov 18 '05 #4
Generally speaking, you can only have one form in an asp.net page. Perhaps
you can show the code that you are trying to make work? It would be easier
to give advice.

"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:ee**************@tk2msftngp13.phx.gbl...
There is a problem. I allready have a form in this page. Can i have 2
forms
in the same page?

I am asking this because i got an error.

Miguel

"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:Oa**************@tk2msftngp13.phx.gbl...
Hi Miguel,

An ASP.NET Imagebutton control would give you the effect you want:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
ImageButton1.Attributes.Add _
("onclick", _
"window.open('http://www.google.com',null," & _
"'height=200,width=400," & _
"status=yes,toolbar=no,menubar=no," & _
"location=no');return false;")
End Sub
<form id="Form1" method="post" runat="server">
<asp:ImageButton id="ImageButton1" runat="server"

ImageUrl="http://www.google.ca/intl/fr_ca/images/logo.gif"></asp:ImageButton

</form>

Ken
Microsoft MVP [ASP.NET]
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:e$**************@tk2msftngp13.phx.gbl...
> Hello,
>
> i have an image with the following code:
> <img src="image/panel.gif" width="20" height="80"
> onClick="fnLoadNewWindow('http://www.google.com');">
>
> When i click the image the Javascript Function fnLoadNewWindow opens a new > window with google.com.
>
> The problem is that the mouse doesn't change when it's over the image
> to
> the
> icon that usually shows when the image is a link.
>
> What am i doing wrong here?
>
> Thank You,
> Miguel
>
> P.S: The function works fine. A new windows is opened when i click the
> image.
>
>



Nov 18 '05 #5
You might try using a hyperlink instead. You can specify the image uri
for the link to use, plus the navigate url, plus the target of "_blank".
E.g,

<asp:HyperLink id="HyperLink1" runat="server" NavigateUrl="Search.aspx"
ImageUrl="search.jpg" Target="_blank">Search</asp:HyperLink>

or in html,

<a id="HyperLink1" href="Search.aspx" target="_blank">
<img src="search.jpg" alt="Search" />
</a>

HTH,

Chad

Miguel Dias Moura wrote:
Hello,

i have an image with the following code:
<img src="image/panel.gif" width="20" height="80"
onClick="fnLoadNewWindow('http://www.google.com');">

When i click the image the Javascript Function fnLoadNewWindow opens a new
window with google.com.

The problem is that the mouse doesn't change when it's over the image to the
icon that usually shows when the image is a link.

What am i doing wrong here?

Thank You,
Miguel

P.S: The function works fine. A new windows is opened when i click the
image.

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
5
by: Miguel Dias Moura | last post by:
Hello, i have an image with the following code: <img src="image/panel.gif" width="20" height="80" onClick="fnLoadNewWindow('http://www.google.com');"> When i click the image the Javascript...
2
by: Randall Parker | last post by:
Short of generating my own icons is there a way to get the appearance of a button on a form but with behavior that is like a regular link? In particular, I want to be able to right click on a...
33
by: STILL LEARNING | last post by:
I'm not sure if this can even be done, but what prompts the question is my desire to be able to create an "Uber Link" script/code of some sort, such that even if the html page contains nothing but...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.