title: Getting value from enter key submit
body: <p>How can I get the content when the enter key is pressed?</p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
  var HttPRequest = false;
  function doCallAjax(Mode) {
   HttPRequest = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
   HttPRequest = new XMLHttpRequest();
  if (HttPRequest.overrideMimeType) {
  HttPRequest.overrideMimeType('text/html');
  }
  } else if (window.ActiveXObject) { // IE
  try {
  HttPRequest = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
  try {
   HttPRequest = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e) {}
           }
        } 
  
       if (!HttPRequest) {
           alert('Cannot create XMLHTTP instance');
           return false;
        }
  
        var url = 're.asp';
        var pmeters = "lname=" + encodeURI( document.getElementById("txtCustomerID").value) +
                      "&amp;tMode=" + Mode;
  
          HttPRequest.open('POST',url,true);
  
          HttPRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
          HttPRequest.setRequestHeader("Content-length", pmeters.length);
          HttPRequest.send(pmeters);
  
  
          HttPRequest.onreadystatechange = function()
          {
  
               if(HttPRequest.readyState == 3)  // Loading Request
                {
                 document.getElementById("mySpan").innerHTML = "Now is Loading...";
                }
  
               if(HttPRequest.readyState == 4) // Return Request
                {
                 document.getElementById("mySpan").innerHTML = HttPRequest.responseText;
                 document.getElementById("txtCustomerID").value = '';
                }
  
          }
  
     }
  &lt;/script&gt;
  
   &lt;form name="frmMain"action="#"&gt;
   &lt;textarea name="txtCustomerID" id="txtCustomerID"onkeydown="if (event.keyCode == 13) { this.form.submit(); return false; }"&gt;&lt;/textarea&gt;
  
  
  **&gt; how to get content when enter form keyboard (enter submit function)**
  
   &lt;input type="button" name="btnAdd" id="btnAdd" value="Add"OnClick="JavaScript:doCallAjax('ADD');"&gt;
  
   &lt;span id="mySpan"&gt;&lt;/span&gt;
   &lt;/form&gt;
  </code></pre>
  
  <blockquote>
    
  </blockquote>