title: How to capture enter key in html and redirect to asp page?
body: <p>in my plain HTML page, i had a textbox for user to input keyword and then redirect to asp page.
  i use javascript to capture keywords when user click submit button.</p>
  
  <p>but when user press enter, the HTML page will reload and return error page.
  how can i capture enter key event ? so that it will redirect to asp page.
  thanks</p>
  
  <p>my javascript code as follows:</p>
  
  <pre><code>function searching() {            
              var keywordsStr = document.getElementById('keywords').value;
              var cmd = "http://xxx/SearchEngine/Searching.aspx?keywords=" + encodeURI(keywordsStr) ;
              window.open(cmd);
          }
  </code></pre>
  
  <p>my html code as follow:</p>
  
  <pre><code>   &lt;form name="form1" method="post" action="" &gt;
       &lt;input name="keywords" type="text" id="keywords" size="50" &gt;
       &lt;input type="submit" name="btn_search" id="btn_search" value="Search" onClick="javascript:searching(); return false;"&gt;
       &lt;input type="reset" name="btn_reset" id="btn_reset" value="Reset"&gt;
     &lt;/form&gt;
  </code></pre>