Ok, I’ve got this function:
/* jsHandler.js */
function inc(filename)
{
var body = document.getElementsByTagName('body').item(0);
script = document.createElement('script');
script.src = filename;
script.type = 'text/javascript';
body.appendChild(script)
}
What i would like is extending the script to tell js where to insert the js.file, like, say i have this in html:
<div id="mydiv"></div>
<iframe id="myiframe"></iframe>
i call
inc(this.js, mydiv)
to include the js.file in the div “mydiv”,
resulting in:
<div id="mydiv"><script src="this.js" type="text/javascript"></script></div>
How do i do that?
Try this…