开发者

Onmouseover using Hyperlinks

开发者 https://www.devze.com 2023-02-05 07:04 出处:网络
I have a hyperlink and 2 pictures (one is the link\'s normal picture and the other is its onmouseover picture)

I have a hyperlink and 2 pictures (one is the link's normal picture and the other is its onmouseover picture)

I can't figure out how to make the hyperlink's picture change onmouseover. I know I can do it with the 'a' tag but this tag doesn't support this : '~/Site/Page.aspx' so if I want to navigate through folders I need to us开发者_运维问答e '../../Site/Page.aspx' which is inaccurate.

So how can I change picture with the asp:hyperlink button?


Don't. Use css:

a {
  background-image: url(images/image1.jpg);
}
a:hover {
  background-image: url(images/image2.jpg);
}

Only use specific selectors for you case, of course.


I'd also recommend the CSS route, however to ensure no latency with image load you could merge the two images into the one file with an image editor and use 'background-position' to switch the viewable portion of the image.

0

精彩评论

暂无评论...
验证码 换一张
取 消