Posted by Jasen Betts on 01/24/06 08:48
> thanks Jasen! thats what I am looking for.
> BUT the book I am looking at says that the onload() handler for a SCRIPT
> element is a Microsoft extension, not DOM spec. I need to work with
> Firefox. ;-)
firefox supports it too, (well mozilla did last month... when I tried it)
onreadystatechange is an IE extension and is IE only.
> Can I do a ScriptElem.setAttribute() and attach an onload() handler?
You don't need setAttribute,
ScriptElem.onload=onLoadFunction;
having previously done
function onLoadFunction(){ /* your code here */ }
or similar
> I am trying to check the DOM level 2 ref at
> http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html
>
> but its really hard to read.
I wasn't aware that dynamically loading script was actually covered by the
standard.
This code works in mozilla:
function pastejs(url,onloadfunc){
var s = document.createElement("script");
s.onload=onloadfunc;
s.type = "text/javascript";
s.src = url;
document.body.appendChild(s);
}
Bye.
Jasen
[Back to original message]
|