JS文件提速方法:
2 H& Y0 E# d9 p8 l把通常加载方式:<script src="dancead.js"></script> 1 X, @* _5 Y% z& Z+ V! x
改变成:<script type="text/javascript"> document.write("<scr"+"ipt src=\"dancead.js\"></sc"+"ript>") ; </script> 2 Z% J; h& W3 C" K4 b
3 ]$ G9 F W6 ~4 u; D6 L9 KJS文件延迟加载方法: / c. N/ @! T9 X4 K! G
JS延迟加载代码如下:<script language="JavaScript" src="" id="ToTwo"></script>
3 I& Y( x0 p; L' H7 n. m<script> setTimeout("document.getElementById('ToTwo').src='http://www.xp37.com/include.js'; ",3000);//延时3秒 </script> |