title: Submit HTML form, perform javascript function (alert then redirect)
body: <p>I have a JavaScript function that works great when I call it through an 'onClick' method.
  Basically what it does is pull data from a html form, and then based on that data, redirects to another page.</p>
  
  <p>However, when I press the 'enter' button to submit the form/call the JavaScript function, instead of using a onClick button to call the JavaScript function, it doesn't respond as I would like it to.</p>
  
  <p>I would like for when a user presses the enter button on their keyboard, the same thing happens as if they were to click the 'proceed button' on by page (which calls the function via onClick)</p>
  
  <p>Here is my code:</p>
  
  <p>The JS Function:</p>
  
  <pre><code>function completeAndRedirect(){
      alert('You\'re nearly there! To complete your entry, you simply need to tap \'continue\' on the next page. Good luck!');
      location.href='http://google.com/?SID='+'&lt;? echo $CATEGORY; ?&gt;'+','+'&lt;? echo $PLATFORM; ?&gt;'+','+'&lt;? echo $DEVICE; ?&gt;'+'&amp;email='+document.forms[0].elements[0].value;
  }
  </code></pre>
  
  <p>Here is the form:</p>
  
  <pre><code>&lt;form action="" method="post" onsubmit="completeAndRedirect()"&gt;
      &lt;input type="text" id="Edit1" style="width:280; height:50; font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif; font-size:22px"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Huge thanks to anyone who can help out!</p>