stuck with javascript-html output
<p>I am kind of stuck in weird problem. i cant find the problem with the following code</p>

<pre><code> &lt;html&gt;
    &lt;head&gt;

&lt;script type="text/javascript"&gt;

    // Import GET Vars
   document.$_GET = [];
   var urlHalves = String(document.location).split('?');
   if(urlHalves[1]){
      var urlVars = urlHalves[1].split('&amp;');
      for(var i=0; i&lt;=(urlVars.length); i++){
         if(urlVars[i]){
            var urlVarPair = urlVars[i].split('=');
            document.$_GET[urlVarPair[0]] = urlVarPair[1];
         }
      }
   }


    var tag_tag=document.$_GET['tags'];
    alert(tag_tag);

document.getElementById("resultElem4").innerHTML=tag_tag;


&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;p id='resultElem4'&gt;&lt;/p&gt;


&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>its showing the string in alert but not in html when i call it like result.php?tags=cat</p>
