I know that IE doesn\'t have a load
event for elements — is there any way to make up for that reliably?
I\'ve seen some tal
I want to add that if you don't support IE7 and below, you don't need onreadystatechange
stuff. Source: quircksmode.org
Simplified and working code from original answer:
function scriptTag (src, callback) {
// src is just a string now!
var s = doc.createElement('script');
s.type = 'text/javascript';
s.src = src;
s.async = false;
s.onload = callback;
document.body.appendChild(s);
}