【发布时间】:2013-08-26 19:12:31
【问题描述】:
我正在使用Buttons in the w3schools Tryit editor,我试图弄清楚当我点击“取消”按钮时如何让我的浏览器重定向到一个 URL。
这是我尝试过的:
<form action="demo_form.asp" method="get">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<button type="submit" value="Submit">Submit</button>
<button type="reset" value="Reset">Reset</button>
<button type="cancel" onclick="javascript:window.location='http://stackoverflow.com';">Cancel</button>
</form>
但它不起作用。有什么想法吗?
【问题讨论】:
标签: javascript html forms htmlbutton