Thursday, November 10, 2011

Performing a Simple Button-rollover

The rollover effect experience is when the end user hovers their mouse over a button on a Web page and then button itself changes color or image. This can be especially useful for Web pages that have attractive buttons, and it would be beneficial from a usability viewpoint to notify the end user of the button they would be clicking prior to clicking it.
This is fairly easy to do before server controls came along and it isn't that difficult now with server controls. The code for performing such an operation is as follows:

<form id="form1" runat="server">
<asp:ImageButton id="ImageButton2" onmouseover="this.src='images/img2.jpg'"
onmouseout="this.src='images/img1.jpg';" runat="server" ImageUrl="~/Images/img1.jpg"/>

No comments:

Post a Comment