通常我们的网站里面会加载一些js代码,统计啊,google广告啊,百度同盟啊,阿里妈妈广告代码啊,最后弄得页面加载速度很慢,很慢。
<script type="text/javascript">
document.write("<scr"+"ipt src=\"xxx.js\"></sc"+"ript>")
</script>
<script src="[url]http://s69.cnzz.com/stat.php?id=265381&web_id=265381&show=pic"[/url] language="JavaScript" charset="gb2312"></script>
<script type="text/javascript">
document.write("<scr"+"ipt src=\"[url=http://s69.cnzz.com/stat.php?id=265381&web_id=265381&show=pic\]http://s69.cnzz.com/stat.php?id=265381&web_id=265381&show=pic\[/url]" language=\"JavaScript\" charset=\"gb2312\"></sc"+"ript>")
</script>
解决办法:换一个js包含的方式,让javascript加载速度倍增。
把通常加载方式:
<script src="xxxx.js"></script>
改变成
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
-------------------------------------
举个例子:
比如下面是 Web标准化网站 www.div-css.com 申请的站长统计代码,以前尽管是把它放在页面的最底部,但还是拖累页面加载进度。
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
我们可以把它换成这样的方式来加载(任然放在页面最底部):
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
本文转载自:http://bbs.div-css.com/read.php?tid=76&page=e&#a