如何编写HTML中的按钮以转到链接? [英] How can I program a button in HTML to go to a link?
本文介绍了如何编写HTML中的按钮以转到链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Razor视图中具有以下内容:
I have the following in my Razor view:
<button class="float-left submit-button" title="Test Questions">Test</button>
我如何做到这一点,以便在单击按钮时将其转到以下URL?
How can I make it so that when the button is clicked it goes to the following URL ?
"~/F000C/Home-About"
推荐答案
<button class="float-left submit-button" title="Test Questions" onclick="javascript:window.open('~/F000C/Home-About')">Test</button>
如果您确实想要按钮元素,则应插入onclick
事件.
if you really want button element, then you should insert onclick
event.
或:
<button class="float-left submit-button" title="Test Questions" onclick="window.location.assign('~/F000C/Home-About')">Test</button>
这篇关于如何编写HTML中的按钮以转到链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文