JS文件提速方法: . V) W% Q! p. w v9 b. a* M( R8 Z
把通常加载方式:<script src="dancead.js"></script>
& N# ^" I9 u) @改变成:<script type="text/javascript"> document.write("<scr"+"ipt src=\"dancead.js\"></sc"+"ript>") ; </script>
2 I6 m" ^; q1 s; }$ F+ |" d2 R6 @
" L T' N% O: `3 L
JS文件延迟加载方法:
. S+ E7 B$ R$ a Z) e1 NJS延迟加载代码如下:<script language="JavaScript" src="" id="ToTwo"></script>
) i$ B) C4 F7 y6 M! y7 a" w3 x<script> setTimeout("document.getElementById('ToTwo').src='http://www.xp37.com/include.js'; ",3000);//延时3秒 </script> |