Making a hyperlink inside a button in asp.net
I have a button on my asp.net page that (upon mouseover) ne开发者_如何学JAVAeds to act like a hyperlink (the hand cursor). I cannot use a linkbutton because I need the GUI of a regular asp:button.
Is there a way to create the hyperlink cursor on mouseover?
Thanks
Using css you can say:
.anchor {cursor: pointer; cursor: hand;}
and then in your aspx:
<asp:Button CssClass="anchor" ... >
Use the following for the hand cursor on button mouse over:
<asp:Button ID="Button1" runat="server" Text="Click Me" CssClass="ButtonClass" />
The in a style sheet or inline in the page itself define the class:
.ButtonClass
{
cursor: pointer; cursor: hand;
}
Use both (pointer and hand) for cross browser compatibility.
Add this into your button's markup...
style="cursor: pointer; cursor: hand;"
so...
<asp:Button id="test" text="test" runat="server" style="cursor: pointer; cursor: hand;" />
精彩评论