I'm using a simple AJAX script to dynamically insert a script tag.
Works fine with everybody but IE7. Gives me an "Unknown runtime error"
and looking around the web, I see that this is an issue with modifying
the DOM. I wrote a simple demo to show that I can create and insert
the tag, but actually placing some content in the tag (as either a
text or html property) gives me the error.

Test code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Document</title>
<script type="text/javascript" src="/js/mootools-1.2.4-core.js"></
script>
<script type="text/javascript" src="/js/mootools-1.2.4.2-more.js"></
script>
</head>
<body>
<div id="target">&nbsp;</div>
<script language="JavaScript" type="text/javascript">
window.addEvent('domready', function() {
                                        js = new 
Element('script',{type:'text/javascript',text:'//
test'});//
                                        $('target').adopt(js);
});
</script>
</body>
</html>

If I drop out the text property in the constructor, I get the tag, no
errors. As I said this works just fine in other browsers.

Looking for the proper technique for dynamically writing a script into
a page that IE will be happy with.


-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to