Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Click in Image to open Link?

Reply
Thread Tools

Click in Image to open Link?

 
 
Miguel Dias Moura
Guest
Posts: n/a
 
      04-15-2004
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.


 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      04-15-2004
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" <(E-Mail Removed)> wrote in message
news:e$(E-Mail Removed)...
> 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.
>
>


 
Reply With Quote
 
 
 
 
Curt_C [MVP]
Guest
Posts: n/a
 
      04-15-2004
style="cursor:'hand';"


--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com


"Miguel Dias Moura" <(E-Mail Removed)> wrote in message
news:e$(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Miguel Dias Moura
Guest
Posts: n/a
 
      04-15-2004
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]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:e$(E-Mail Removed)...
> > 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.
> >
> >

>



 
Reply With Quote
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      04-15-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:e$(E-Mail Removed)...
>> > 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.
>> >
>> >

>>

>
>


 
Reply With Quote
 
chad [email at] gosigma.com
Guest
Posts: n/a
 
      04-15-2004
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.
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: how to open a file in some application using Tkinter i am usingTKINTER to create GUI application i want to know how to open a worddocument in open office or any other applicatio Fredrik Lundh Python 1 01-09-2008 10:40 AM
click click click Andy Morrison Computer Support 7 12-20-2007 06:50 AM
Tool to right click image in windows explorer and rotate image right or left 90 degrees siliconpi Digital Photography 2 11-29-2004 12:56 PM
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
Open Image in 'Kodak Image Edit Control' with web browser. amita ASP General 0 08-18-2003 05:16 AM



Advertisments