javascript - How to create a HTML Cancel button that redirects to a URL -


i playing buttons in w3schools tryit editor, , trying figure out how make browser redirect url when click on "cancel" button.

here's have tried:

<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>

but doesn't work. ideas?

cancel not valid value type attribute, button defaulting submit , continuing submit form. mean type="button".

(the javascript: should removed though, while doesn't harm, entirely useless label)

you don't have button-like functionality though, better off with:

<a href="http://stackoverflow.com"> cancel </a> 

… possibly css make button.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -