I really hate IE. Take this code to create a
script
tag and fire a callback once it's loaded:
var script = document.createElement("script");
script.setAttribute("type","text/javascript");
script.setAttribute("src", fileName);
Event.observe( script, "load", function() {...});
Works great in Firefox. But in IE6? Never fires. You have to do this instead:
Event.observe( script, "readystatechange", function() {
if(script.readyState == "complete") {
...do stuff...
}
} );
It's not that there is extra functionality. It's that a decision was made to provide a complicated interface that can handle like two extra edge cases, but the much simpler, obvious and consistent 'onload' handler gets left out.