title: how to access a local javascript var in greasemonkey
body: <p>it's been an hour I'm going crazy with this problem.</p>
  
  <p>There is a page, with a javascript function:</p>
  
  <pre><code>&lt;script&gt;
    function foofunction(foo){
        dosomething(foo);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>I have replaced this function with a greasemonkey script:</p>
  
  <pre><code>var scriptCode = new Array();
  
  scriptCode.push('function foofunction(foo){    ');
  scriptCode.push('    dosomething(foo);             ');
  scriptCode.push('    myinjectedcode;               ');
  scriptCode.push('}'                                 );
  
  var script = document.createElement('script');
  script.innerHTML = scriptCode.join('\n');
  scriptCode.length = 0;
  
  document.getElementsByTagName('head')[0].appendChild(script);
  //here I have to access to foo value
  </code></pre>
  
  <p>This works.</p>
  
  <p>Now I have to access to foo value in my greasemonkey script, how can I?</p>