title: Pressing Enter Won't Submit Form - Javascript
body: <p>I'm building a basic site where I want users to be able to enter a 'keyword' that redirects them to a specific page. Different keywords will redirect to different pages.</p>
  
  <p>For example, Apple will redirect to Apple.com (just an example, not on my site).</p>
  
  <p>I found another person's Javascript for this on another website (seen below). It works nearly perfect except for one minor detail - users MUST click the button for the redirect to happen. Pressing the enter key does not work. I've tried changing the input type to "submit" rather than "button," but still to no luck. Anyone have some advice?</p>
  
  <pre><code>&lt;script type="text/JavaScript"&gt;
  &lt;!--
  function Login(){
  var done=0;
  var keyword=document.enter_keyword.keyword.value;
  //keyword=keyword.toLowerCase();
  if (keyword=="toms") { window.location="http://www.toms.com"; done=1; }
  if (keyword=="apple") { window.location="http://www.apple.com"; done=1; }
  if (keyword=="orange") { window.location="http://www.orange.com"; done=1; }
  if (done==0) { alert("WARNING:Incorrect keyword you plonker!!!"); }
  }
  //--&gt;
  &lt;/script&gt; 
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;form name=enter_keyword&gt;
  &lt;table border="1" cellpadding="2" cellspacing="2" bgcolor="#7B97E0"&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;font color="#ffffff"&gt;&lt;b&gt;Enter keyword:&lt;/b&gt;&lt;/font&gt;
  &lt;/td&gt;
  &lt;td&gt;&lt;input type=text name=keyword&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td colspan=2 align=center&gt;
  &lt;input type=button value="Login!" onClick="Login()"&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>