javascript延迟加载外部js文件
function _GetJsData(url, callback) {
var scripts = document.createElement('script');
document.body.appendChild(scripts);
scripts.onload = function() {
isok();
// document.body.removeChild(this);
};
scripts.onreadystatechange = function() {
if (this.readyState == "loaded") {
isok();
// document.body.removeChild(this);
}
};
scripts.charset = "GBK";
scripts.src = url;
}
_GetJsData('http://i03.youxigu.com/js/util/yahoo.js','isok');
var isok=function(){alert('isok')};