title: HTML prevent space bar from scrolling page
body: <p>I'm using the code:</p>
  
  <pre><code>window.onkeydown = function(e) { 
      return !(e.keyCode == 32);
  };
  </code></pre>
  
  <p>which does exactly what I want, stops the page from scrolling when the spacebar is pressed. However it also prevents the user from typing spaces in a textbox</p>
  
  <p>Is there a way to prevent the spacebar-scroll as well as retain the spacebar functionality while typing?</p>