NOTE: In the examples below, I have used [] brackets
where the normal <> brackets appear. To use the code, replace the [] brackets
with the normal <> brackets.
Adding a hover feature to change the background color of a ASPX button is
relatively simple.
1. Add a button to your .aspx page:
[asp:Button id="btnWn" runat="server" Text="Open Java Window"][/asp:Button]
2. Add to the Page_Init function of your .aspx.cs page:
btnWn.Attributes.Add("onmouseover","this.style.backgroundColor='steelblue'");
btnWn.Attributes.Add("onmouseout","this.style.backgroundColor='darkblue'");
3. The same methodology can be used for other styles, for example the cursor:
btnWn.Attributes.Add("onmouseout","this.style.cursor='default'");
btnWn.Attributes.Add("onmouseover","this.style.cursor='hand'");
A sample implementation can be found at
http://dn.yyyz.net/DnYzTest01.aspx [^] -
all buttons have the hover feature.