title: How to create a HTML Cancel button that redirects to a URL
body: <p>I am playing with the <a href="http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_button_type" rel="noreferrer">Buttons in the w3schools Tryit editor</a>, and I am trying to figure out how to make my browser redirect to an URL when I click on the "Cancel" button.  </p>
  
  <p>Here's what I have tried:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form action="demo_form.asp" method="get"&gt;
    First name: &lt;input type="text" name="fname"&gt;&lt;br&gt;
    Last name: &lt;input type="text" name="lname"&gt;&lt;br&gt;
    &lt;button type="submit" value="Submit"&gt;Submit&lt;/button&gt;
    &lt;button type="reset" value="Reset"&gt;Reset&lt;/button&gt;
    &lt;button type="cancel" onclick="javascript:window.location='http://stackoverflow.com';"&gt;Cancel&lt;/button&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>But it doesn't work.  Any ideas?</p>