Inserting some javascript code with Javascript
<p>I am using a way to insert some javascript code in the page which works with all browsers but not with IE. Here is a sample:
<a href="http://boxfly.free.fr/tmp/innerjs.html" rel="nofollow">http://boxfly.free.fr/tmp/innerjs.html</a></p>

<p>The line which does not work properly with IE is:</p>

<pre><code>ele.text = document.getElementById('DIV_js').innerHTML ;
</code></pre>

<p>If I change this line to:</p>

<pre><code>ele.text = 'alert("Hello")' ;
</code></pre>

<p>It works. But I need to be able to insert code which is on a lot of lines, not only one line for displaying an alert, that's why I am using a DIV to contain the Javascript code... ;)</p>

<p>Does anyone know how to make this script work with IE:</p>

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

&lt;div id="DIV_js" style="display:none;"&gt;
var i = 'here' ;
function hello() {
  alert('toto says '  + i) ;
}
&lt;/div&gt;
&lt;script&gt;

var ele = document.createElement("script") ;
ele.type = 'text/javascript' ;
ele.text = document.getElementById('DIV_js').innerHTML ;

document.body.insertBefore(ele, (document.getElementsByTagName("div"))[0]);

&lt;/script&gt;

&lt;span onClick="hello();"&gt;Click to display alert&lt;/span&gt;

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