document.write mishap in Opera

Forums » Dev.Opera » General Web Development Discussions

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

15. May 2010, 11:47:39

document.write mishap in Opera

I have the following html file that renders differently in Opera than every other browser.

<html>
<body>
<script type="text/javascript">
document.write('<div style="width:300px; height:250px; border:1px solid red">');
document.write('<script src="./test.js"></scr'+'ipt>');
document.write('</div>');
</script>
</body>
</html>


and here is the JS file

document.write('<div style="width:300px;height:250px;border:1px solid blue"></|<html>
div>');


Why doesn't opera put the output of the script in test.js inside the div containing the <script> tag? Any clues?

Forums » Dev.Opera » General Web Development Discussions