如何在ASP.NET
设置ImageButton
以在鼠标悬停时更改图片?
<asp:ImageButton onmouseover="changePic(this);" ...
JavaScript:
function changePic(obj)
{
obj.src = "<picture path>";
}
You will have to do this in the client side - that is, using javascript.
You can add a client side onMouseOver="this.src = 'pathToOtherimage'"
attribute and a similar one for onMouseOut
to revert back.
It can't be done from the server-side (in the C# code), but rather must be done on the client-side (in JavaScript). Starting with that fact, there are various approaches to the subject.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.