I've been struggling with the following:

In Internet Explorer you can dynamically change the src attribute of a script tag - and the new src will be read and parsed.

In Gecko browsers - the same is not true:

var oR = document.getElementById('something');
alert(oR); // Check we have an object - in case Javascript console misses the error
oR.src = 'test.js';

test.js would have a simple alert in it... nothing!

So I tried the following:

var scr = document.createElement('SCRIPT');
scr.language="Javascript";
scr.type="text/javascript";
scr.src ="cat.js";
document.body.appendChild(src);

Still nothing...
I tried setting the src after adding the child, nothing.

Does anyone have any ideas on how to achieve this - short of opening a new page in a new window and document.writing it to that, and letting that refer to it's parent... ( just change top to self.opener) ???

Any ideas ?


Cheers

Flawless