The code is as follows:
var otherJScipt = document.createElement("script ");
otherJScipt = document.createElement("script");
otherJScipt.setAttribute("type", "text/javascript");
otherJScipt.setAttribute("src", "/xxx. js");
document.getElementsByTagName("head")[0].appendChild(otherJScipt);//Append to the head tag
//Judge the server
if (navigator .userAgent.indexOf("IE") >= 0) {
//Events under IE
otherJScipt.onreadystatechange = function () {
//Judgment under IE to determine whether loading is complete
if (otherJScipt && (otherJScipt.readyState == "loaded" || otherJScipt.readyState == "complete")) {
otherJScipt.onreadystatechange = null;
callMyFun();
}
};
}
else {
otherJScipt.onload = function () {
otherJScipt.onload = null;
callMyFun();
};
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn