JS文件提速方法:
; I' \0 Z- j( v; a. ~* ]把通常加载方式:<script src="dancead.js"></script>
4 |( O" A6 U& r. u9 L改变成:<script type="text/javascript"> document.write("<scr"+"ipt src=\"dancead.js\"></sc"+"ript>") ; </script>
$ ?6 h$ s0 ~6 R& M0 v+ M8 j
: c4 @: I. V0 R: Z2 D& f
JS文件延迟加载方法:
4 J6 s- P* ?# O S, ^JS延迟加载代码如下:<script language="JavaScript" src="" id="ToTwo"></script> ) \* w& y- X" _5 e3 Z# F
<script> setTimeout("document.getElementById('ToTwo').src='http://www.xp37.com/include.js'; ",3000);//延时3秒 </script> |