-
February 29th, 2008, 03:33 PM
#1
hyperlink onmouseover
hi... why does this work (btnContinue is an ImageButton)?
btnContinue.Attributes.Add("OnMouseOver", "this.src='/site/images/start-over.png'");
btnContinue.Attributes.Add("OnMouseOut", "this.src='/site/images/start-up.png'");
and this doesn't (HyperLink):
HyperLink1.Attributes.Add("OnMouseOver", "this.src='/site/images/print-over.png'");
HyperLink1.Attributes.Add("OnMouseOut", "this.src='/site/images/print-over.png'");
how can i change the image using HyperLink webcontrol?
i need some help...
i don't know what property i have to use so it can work...
thanks in advance...
-
February 29th, 2008, 04:20 PM
#2
Re: hyperlink onmouseover
A hyperlink doesn't know what an image is (or any src property). But you can put an image 'inside' a hyperlink.
Code:
<asp:HyperLink NavigateUrl="~/Default.aspx" runat="server" ID="lnk">
<img id="ImageInHyperlink" src="Controls/marker_top.gif" alt="" />
</asp:HyperLink>
Then in your codebehind add:
Code:
lnk.Attributes.Add("OnMouseOver",
"document.getElementById('ImageInHyperlink').src='imageA.gif'");
lnk.Attributes.Add("OnMouseOut",
"document.getElementById('ImageInHyperlink').src='imageB.gif'");
- petter
-
March 3rd, 2008, 01:26 PM
#3
Re: hyperlink onmouseover
thanks, it worked...
the only thing it didn't do was changing mouse behavior...
with ImageButtons it changes from arrow to hand...
and it didn't do it automatically...
i'll see what i can do...
-
March 3rd, 2008, 02:28 PM
#4
Re: hyperlink onmouseover
my mistake
forget about the mouse cursor stuff...
i had removed the hyperlink's url, that's why i was not getting the hand cursor..
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|