assign the javascript code by a javascript function
<p>For some reason, I have to assign the javascript code by a javascript function, like the code at below.</p>

<pre><code>&lt;html&gt;
     &lt;head&gt;
    &lt;script&gt;
        window.onload = init();
        function init(){

            document.getElementsByName('content')[0] = alert('LOL');

        }
    &lt;/script&gt;
        &lt;script type="text/javascript" name="content"&gt;


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

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

<p>After page load, the expected result should like following</p>

<pre><code>&lt;html&gt;
     &lt;head&gt;
     &lt;script type="text/javascript"&gt;
        alert('LOL');

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

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

<p>However, the alertbox doesn't display. Is there anyone can help me?</p>
