js判断异步js加载完毕

let j = d.createElement('script'); j.async = true; j.src ='js地址'; if (typeof callback === "function") { if (typeof document.attachEvent !== "object") { j.onload = function () { callback(); // 回调函数调用 }; } else { j.onreadystatechange = function () { var r = j.readyState; if (r === "loaded" || r === "complete") { j.onreadystatechange = null; callback(); // 回调函数调用 } }; } } d.body.appendChild(j);
上一篇:JavaScript数据类型转换


下一篇:c# 枚举的定义,枚举的用法,获取枚举值