Javascript not running from address bar
<p>I have written the following Javascript code : </p>

<pre><code>var outerFrame = document.getElementById("myframe");
    var outerDoc = outerFrame.contentDocument || outerFrame.contentWindow.document;
    var innerFrame = outerDoc.getElementsByName("frame").item(0);
    var innerDoc = innerFrame.contentDocument || innerFrame.contentWindow.document;
    var arr=[10,11,12,13,14,15,16,17,18,19,110,111,112,113,114,115,116,117,118,119]; 
    for(i=0;i&lt;20;i++){
        var randomVal = Math.floor((Math.random()*5));
        if (innerDoc.getElementsByName("point"+arr[i])[randomVal]) {innerDoc.getElementsByName("point"+arr[i])[randomVal].checked = true; }
        }
</code></pre>

<p>I want people to be able to run it when on a particular website by copy-pasting it to the address bar. A little Google search tells me I need to append 'javascript:' before it. However, it does not work; nothing happens when I try to execute the code from the address bar. The code runs fine when I execute it from the console.</p>

<p>An error that comes up when trying to execute it from the address bar is :</p>

<blockquote>
  <p>uncaught exception: ReferenceError: document is not defined</p>
</blockquote>

<p>Any help ?</p>
