工具方法:加载js脚本


function loadScript(url, callback) { var script = document.createElement("script") script.type = "text/javascript"; if (script.readyState) { //IE script.onreadystatechange = function () { if (script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; if (callback) callback(); } }; } else { //Others script.onload = function () { if (callback) callback(); }; } script.src = url; var d = document.documentElement || document.body; d.appendChild(script); }

你可能感兴趣的:(工具方法:加载js脚本)