<p>I have a multi-frame layout. One of the frames contains a form, which I am submitting through XMLHttpRequest. Now when I use document.write() to rewrite the frame with the form, and the new page I am adding contains any javascript then the javascript is not exectuted in IE6?</p>

<p>For example:</p>

<pre><code>document.write("&lt;html&gt;&lt;head&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/head&gt;&lt;body&gt;test&lt;/body&gt;&lt;/html&gt;");
</code></pre>

<p>In the above case the page content is replaced with test but the alert() isn't executed. This works fine in Firefox.</p>

<p>What is a workaround to the above problem? </p>

Workaround is to programmatically add
```
<script>
```
blocks to head DOM element in JavaScript at Callback function or call eval() method. It's only way you can make this work in IE 6.