异步动态加载JS并运行(示例代码)
(编辑:jimmy 日期: 2025/5/13 浏览:3 次 )
如下所示:
复制代码 代码如下:
(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);
})();
下一篇:JQuery中$.ajax()方法参数详解及应用