JS文件提速方法: 9 ?& O: F0 M( t4 e3 \! _' q
把通常加载方式:<script src="dancead.js"></script> 2 e+ I4 `5 y$ a1 Z
改变成:<script type="text/javascript"> document.write("<scr"+"ipt src=\"dancead.js\"></sc"+"ript>") ; </script> # m# F+ g* U2 T" T+ w) }1 ?, u
% p) B& t- B% q7 @$ P/ Y/ @* @ ?
JS文件延迟加载方法: 7 M8 s3 N8 u2 x; l" l: R7 i
JS延迟加载代码如下:<script language="JavaScript" src="" id="ToTwo"></script>
B8 \' H$ N9 ]6 M5 v<script> setTimeout("document.getElementById('ToTwo').src='http://www.xp37.com/include.js'; ",3000);//延时3秒 </script> |