foxtool23 发表于 2013-2-7 17:03:37

哈哈找到一个能动态加载js的方法

哈哈找到一个能动态加载js的方法
//加载新的jsfunction _GetJsData(url, callback) {    var scripts = document.createElement("script");    document.body.appendChild(scripts);    scripts.onload = function() {      callback();      document.body.removeChild(this);    };    scripts.onreadystatechange = function() {      if (this.readyState == "loaded") {            callback();            document.body.removeChild(this);      }    };    scripts.charset = "GBK";    scripts.src = url;}_GetJsData('http://www.uefirst.com/index.js',isok);var isok=function(){alert('isok')};
http://www.uefirst.com/bbs/read-htm-tid-22.html
页: [1]
查看完整版本: 哈哈找到一个能动态加载js的方法