Make a button show as a link
I have this button that calls a javascript function,.. how can i make it into a link?
<button onclick="openWin(); return false;">开发者_如何学JAVA
Choose Destination and date</button>
<a href="link/to/page/in/case/javascript/is/off" onclick="openWin(); return false;">
Choose Destination and date
</a>
Use the <asp:HyperLink />
control.
Here is some documentation
<asp:HyperLink
AccessKey="string"
BackColor="color name|#dddddd"
BorderColor="color name|#dddddd"
BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
Inset|Outset"
BorderWidth="size"
CssClass="string"
Enabled="True|False"
EnableTheming="True|False"
EnableViewState="True|False"
Font-Bold="True|False"
Font-Italic="True|False"
Font-Names="string"
Font-Overline="True|False"
Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
Large|X-Large|XX-Large"
Font-Strikeout="True|False"
Font-Underline="True|False"
ForeColor="color name|#dddddd"
Height="size"
ID="string"
ImageUrl="uri"
NavigateUrl="uri"
OnDataBinding="DataBinding event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler"
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnUnload="Unload event handler"
runat="server"
SkinID="string"
Style="string"
TabIndex="integer"
Target="string|_blank|_parent|_search|_self|_top"
Text="string"
ToolTip="string"
Visible="True|False"
Width="size"
/>
More info : http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hyperlink.aspx
You can also just set the background on a button so it looks like a link:
.no-bg{background: none;}
if it HAS to be a button you can use CSS to make it look and act like a link. ie, hiding the background, making it change color on hover. but best bet is to make it into an actual link w/ an href property.
精彩评论