function loadScript(url){ var hd = document.getElementsByTagName(’head’)[0], js = document.createElement(’script’); js.src = url; js.type = “text/javascript”; if(js.addEventListener){ js.addEventListener(”load”, function(){alert(’loaded’);}, false); }else if(js.attachEvent){ js.attachEvent(”onreadystatechange”, function(){ if(js.readyState === “loaded” || js.readyState === “complete”){ alert(’loaded’); } }); } hd.appendChild(js); }