首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

<转>动态加载js的步骤

2012-08-27 
转动态加载js的方法//加载新的jsfunction _GetJsData(url, callback) {var scripts document.createEl

<转>动态加载js的方法

    //加载新的js      function _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')};  

热点排行