title: Is there a way to pass a variable to keypressed function?
body: <p>I am trying to send the document and the control that the key was pressed in to the keypressed function.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>//Namespace
  MyExt.BrowserOverlay = {
    init: function() {
          var appcontent = document.getElementById("appcontent");   // browser
          if(appcontent)
                appcontent.addEventListener("DOMContentLoaded", MyExt.BrowserOverlay.onPageLoad, true);
    },
  
    onPageLoad: function(aEvent) {
                   var doc = aEvent.originalTarget;
                   if (doc.location.href == "http://something.com"){
                       var txtBox = doc.getElementById('txtBox');
                        txtBox.addEventListener('keypress', keypressed, false); //Error Line
                                  }
                   },
  </code></pre>
  
  <p>…</p>
  
  <p>something like:</p>
  
  <pre><code>
  txtBox.addEventListener('keypress', keypressed(?,doc), false);
  </code></pre>
  
  <pre><code>
  function keypressed(a,doc){
      alert(a); //a relates to keypress
      alert(doc.innerHTML);
  }
  </code></pre>