title: Activate a Javascript function with a keypress
body: <pre><code>    function addone()
      {
              document.getElementById("subtract").disabled=false;
      x += 1;
      document.getElementById("result").innerHTML="Doshi has said OK " + x + " times."
  if(x == 1 ){
      document.getElementById("resetall").disabled=false;
      document.getElementById("reset").disabled=false;
      document.getElementById("result").innerHTML="Doshi has said OK " + x + " time."
  }
  if(x == 0){
      document.getElementById("resetall").disabled=true;
      document.getElementById("reset").disabled=true;
      document.getElementById("result").innerHTML="Doshi has not said OK "
  }
      }
  </code></pre>
  
  <p>I want to start this function when I press the "1" key. How do I do this</p>