JS文件提速方法: ( r0 a0 I! S# k9 w( O( v" B
把通常加载方式:<script src="dancead.js"></script>
[% p. W& E/ J: b& s6 _8 s1 y8 h改变成:<script type="text/javascript"> document.write("<scr"+"ipt src=\"dancead.js\"></sc"+"ript>") ; </script>
) x0 v- q5 g, a3 T
/ J M5 Y# i; w a$ E" X# z/ E m
JS文件延迟加载方法: , D& J9 \9 b9 t( v. ^
JS延迟加载代码如下:<script language="JavaScript" src="" id="ToTwo"></script>
' Y9 D+ W: x, o( C- K<script> setTimeout("document.getElementById('ToTwo').src='http://www.xp37.com/include.js'; ",3000);//延时3秒 </script> |