title: How to exclude components from javascript onkeydown
body: <p>Is is possible?</p>
  
  <p>In my page I got</p>
  
  <p><code>&lt;body onload="debug()" id="content" onkeydown="checkKey()" &gt;</code></p>
  
  <p>and</p>
  
  <pre><code>function checkKey() {
      if ((window.event.keyCode &gt; 9) || (window.event.keyCode &lt; 9)) {
          document.actionForm.saveStatus.value = "Not saved";
      }
  }
  </code></pre>
  
  <p>But I don't want this to happen when the user just goes to the page and uses the search form to submit a search unless session data was saved first so I want to exclude events from the searchbox for the checkkey():</p>
  
  <pre><code>&lt;input onkeypress="javascript:searchWithEnter('Oversikt','fastsearch')" title="Nummerformat:
  
  PCT/SE2009/123456
  PCTSE2009123456
  PSE09123456
  
  ITS/SE09/12345
  ITSSE0912345
  ISE0912345
  
  1234567-8
  12345678" type="text" size="40" name="fastsearch"&gt;
      &lt;input type="button" value="Sök" onclick="javascript:doSubmitFastSearch('Oversikt','fastsearch')"&gt;
  </code></pre>
  
  <p>Should I just remove the onkeypress from the body tag and set checkkey() to get called from individual components instead? What do you propose?</p>