I find this excellent code, posted by aemkei as answers to this questions:
You can use the onload
and onreadystatechange
event to understand when the tag is loaded.
var script = new Element("script", {src: "myBigCodeLibrary.js", type: "text/javascript"});
script.onload = script.onreadystatechange = function(){
if (!this.readyState ||
this.readyState == "loaded" || this.readyState == "complete") {
//script is loaded
}
};