|
JS文件提速方法:
* X$ U- V8 y+ B6 {6 ~+ ~) F) u7 X把通常加载方式:<script src="dancead.js"></script>
3 _1 n% G: @5 K改变成:<script type="text/javascript"> document.write("<scr"+"ipt src=\"dancead.js\"></sc"+"ript>") ; </script> / a1 |! p9 ~2 R
- a! T& W- H3 _+ N* M3 b. r; Y
JS文件延迟加载方法:
+ D' n+ Y# r$ [! \; c/ g Z* v% QJS延迟加载代码如下:<script language="JavaScript" src="" id="ToTwo"></script>
+ b6 b3 {% |9 L1 X<script> setTimeout("document.getElementById('ToTwo').src='http://www.xp37.com/include.js'; ",3000);//延时3秒 </script> |