异步动态加载JS并运行(示例代码)


如下所示:

复制代码 代码如下:

(function(){
var ga=document.createElement('script');ga.type?=?'text/javascript';?ga.async?=?true;
ga.src?=?('https:'?==?document.location.protocol???'https://ssl'?:?'http://www')?+?'.google-analytics.com/ga.js';
    var?s?=?document.getElementsByTagName('script')[0];?
    s.parentNode.insertBefore(ga,?s);

})();


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3