<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>断桥残雪部落格断桥残雪</title>
	<atom:link href="http://www.js8.in/author/admin/feed" rel="self" type="application/rss+xml" />
	<link>http://www.js8.in</link>
	<description>专注前端开发，分享JS、jQuery、PHP、CSS、WEB开发技巧</description>
	<lastBuildDate>Wed, 08 Sep 2010 09:58:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<ttl>30</ttl>
		<item>
		<title>IE中flash遮挡div现象的解决方案</title>
		<link>http://www.js8.in/622.html</link>
		<comments>http://www.js8.in/622.html#comments</comments>
		<pubDate>Wed, 08 Sep 2010 09:58:05 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[网络技术]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=622</guid>
		<description><![CDATA[今天开始给网站首页的广告管理系统添加flash广告代码，结果出现IE中（包括IE6+）弹窗广告要flash遮挡的问题，后来想到了常用的iframe方法，最终成功了flash遮挡DIV的bug.最终成功了flash遮挡DIV的bug，但是在IE中还出现了浮动的DIV变化位置后，flash出现div碎片的拖尾现象。继续寻找解决方案。最后终于找了原来flash有个参数wmode可以设置]]></description>
			<content:encoded><![CDATA[<p>今天开始给网站首页的广告管理系统添加<strong>flash</strong>广告代码，结果出现IE中（包括IE6+）弹窗广告要flash遮挡的问题，后来想到了常用的iframe方法（参见《<a title="解决IE6 select z-index无效，遮挡div的bug - 断桥残雪部落格" href="http://www.js8.in/553.html" target="_blank">解决IE6 select z-index无效，遮挡div的bug</a>》），最终成功了flash遮挡DIV的bug，但是在IE中还出现了浮动的DIV变化位置后，flash出现div碎片的拖尾现象。继续寻找解决方案。最后终于找了原来flash有个参数wmode可以设置，于是代码变成了这样：</p>
<blockquote><p>&lt;embed src=&#8221;s.swf&#8221; quality=&#8221;high&#8221; <strong><span style="color: #ff0000;">wmode=&#8221;Opaque&#8221; </span></strong>width=&#8221;150&#8243; height=&#8221;240&#8243;&gt;&lt;/embed&gt;</p></blockquote>
<p>于是IE中Flash遮挡<strong>DIV</strong>的问题成功解决了，看图：</p>
<div id="attachment_621" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.js8.in/wp-content/uploads/2010/09/flash-div.jpg"><img class="size-medium wp-image-621" title="flash遮挡div问题的解决方案" src="http://www.js8.in/wp-content/uploads/2010/09/flash-div-300x144.jpg" alt="flash遮挡div问题的解决方案" width="300" height="144" /></a><p class="wp-caption-text">flash遮挡div问题的解决方案</p></div>
<p><div id="attachment_590" class="wp-caption aligncenter" style="width: 157px"><a target="_blank" href="http://feed.feedsky.com/r57c"><img class="size-full wp-image-590" title="断桥残雪部落格最新的订阅地址" src="http://www.js8.in/wp-content/uploads/2010/08/logo_147x47.gif" alt="断桥残雪部落格最新的订阅地址" width="147" height="47" /></a><p class="wp-caption-text">订阅更“健康”</p></div>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=IE中flash遮挡div现象的解决方案&#038; uri=http://www.js8.in/622.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=IE中flash遮挡div现象的解决方案&#038;bkmk=http://www.js8.in/622.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=IE中flash遮挡div现象的解决方案&#038;iu=http://www.js8.in/622.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/622.html&#038;title=IE中flash遮挡div现象的解决方案" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/622.html&#038;title=IE中flash遮挡div现象的解决方案" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=IE中flash遮挡div现象的解决方案&#038;rurl=http://www.js8.in/622.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=IE中flash遮挡div现象的解决方案&#038;url=http://www.js8.in/622.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=IE中flash遮挡div现象的解决方案&#038;url=http://www.js8.in/622.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=IE中flash遮挡div现象的解决方案&#038;url=http://www.js8.in/622.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/622.html" title="IE中flash遮挡div现象的解决方案">http://www.js8.in/622.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/593.html" title="解决IE下setTimeout传参数的bug" rel="bookmark inlinks">解决IE下setTimeout传参数的bug</a></li>
<li><a href="http://www.js8.in/472.html" title="Javascript在IE与Firefox下的差异写法总结" rel="bookmark inlinks">Javascript在IE与Firefox下的差异写法总结</a></li>
<li><a href="http://www.js8.in/401.html" title="微软官方发布IE调试工具：SuperPreview for IE" rel="bookmark inlinks">微软官方发布IE调试工具：SuperPreview for IE</a></li>
<li><a href="http://www.js8.in/569.html" title="IE中多帧GIF可以触发多次Image().load事件" rel="bookmark inlinks">IE中多帧GIF可以触发多次Image().load事件</a></li>
<li><a href="http://www.js8.in/541.html" title="IE onchange事件触发bug？" rel="bookmark inlinks">IE onchange事件触发bug？</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/622.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于wBox iFrame回调关闭问题的解决方案</title>
		<link>http://www.js8.in/620.html</link>
		<comments>http://www.js8.in/620.html#comments</comments>
		<pubDate>Tue, 07 Sep 2010 05:05:39 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[wBox]]></category>

		<guid isPermaLink="false">http://www.js8.in/620.html</guid>
		<description><![CDATA[最近很多使用我的jQuery弹出框插件wBox的人问我，关于wBox的关闭问题，例如一个页面中使用wBox iframe进来一个页面，而这个页面是进行用户登录，登录成功就关闭wBox，其实实现回调关闭wBox的方法很简单，就是使用iframe的DOM操作即可]]></description>
			<content:encoded><![CDATA[<p>最近很多使用我的<strong>jQuery</strong>弹出框插件wBox的人问我，关于wBox的关闭问题，例如一个页面中使用wBox <strong>iframe</strong>进来一个页面，而这个页面是进行用户登录，登录成功就关闭wBox，其实实现回调关闭<a href="http://www.js8.in/wbox-jquery" target="_blank">wBox</a>的方法很简单，就是使用iframe的DOM操作即可，例如我们的代码这样写：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//wbox赋值出来，然后使用wbox对象的close的方法关闭</span>
<span style="color: #003366; font-weight: bold;">var</span> wbox<span style="color: #339933;">=</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#iframe&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">wBox</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
   	requestType<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;iframe&quot;</span><span style="color: #339933;">,</span>
	target<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;b.html&quot;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>那么我们在页面b.html中进行了用户登录验证，我们验证成功，要关闭<strong>wBox</strong>，就可以在b.html中使用<code>parent.wbox.close()</code>来进行关闭，就像下面的代码，只要我们验证完毕运行closewBox就可以关闭了iframe：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> closewBox<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    parent.<span style="color: #660066;">wbox</span>.<span style="color: #000066;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>关于iframe子页面与父页面之间的<strong>DOM</strong>操作可以参考下面的文章：《<a href="http://www.js8.in/463.html">使用JavaScript在IE和Firefox下进行iframe的DOM操作</a>》
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=关于wBox iFrame回调关闭问题的解决方案&#038; uri=http://www.js8.in/620.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=关于wBox iFrame回调关闭问题的解决方案&#038;bkmk=http://www.js8.in/620.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=关于wBox iFrame回调关闭问题的解决方案&#038;iu=http://www.js8.in/620.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/620.html&#038;title=关于wBox iFrame回调关闭问题的解决方案" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/620.html&#038;title=关于wBox iFrame回调关闭问题的解决方案" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=关于wBox iFrame回调关闭问题的解决方案&#038;rurl=http://www.js8.in/620.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=关于wBox iFrame回调关闭问题的解决方案&#038;url=http://www.js8.in/620.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=关于wBox iFrame回调关闭问题的解决方案&#038;url=http://www.js8.in/620.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=关于wBox iFrame回调关闭问题的解决方案&#038;url=http://www.js8.in/620.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/620.html" title="关于wBox iFrame回调关闭问题的解决方案">http://www.js8.in/620.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/451.html" title="jQuery Easing 动画效果扩展" rel="bookmark inlinks">jQuery Easing 动画效果扩展</a></li>
<li><a href="http://www.js8.in/585.html" title="jQuery弹出框wBox的一个使用实例" rel="bookmark inlinks">jQuery弹出框wBox的一个使用实例</a></li>
<li><a href="http://www.js8.in/529.html" title="通过javascript实现整站黑白效果" rel="bookmark inlinks">通过javascript实现整站黑白效果</a></li>
<li><a href="http://www.js8.in/454.html" title="jQuery 1.4的十五大新功能实例精讲" rel="bookmark inlinks">jQuery 1.4的十五大新功能实例精讲</a></li>
<li><a href="http://www.js8.in/538.html" title="javascript在光标位置插入内容" rel="bookmark inlinks">javascript在光标位置插入内容</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/620.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>提高Firefox的innerHTML()的性能</title>
		<link>http://www.js8.in/607.html</link>
		<comments>http://www.js8.in/607.html#comments</comments>
		<pubDate>Mon, 06 Sep 2010 07:59:33 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[前端优化]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=607</guid>
		<description><![CDATA[Firefox 下innerHTML在操作量大了以后性能下降很厉害,有人写了个提高innhtml性能的代替方法，此方法大大提高了 innerHTML 在 Firefox 和 Safari 上的性能。]]></description>
			<content:encoded><![CDATA[<p>Firefox 下<strong>innerHTML</strong>在操作量大了以后性能下降很厉害,有人写了个提高innhtml性能的代替方法：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> replaceHtml<span style="color: #009900;">&#40;</span>el<span style="color: #339933;">,</span> html<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #003366; font-weight: bold;">var</span> oldEl <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">typeof</span> el <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;string&quot;</span> <span style="color: #339933;">?</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>el<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> el<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">/*@cc_on // 原始的 innerHTML 在 IE 中的性能好一点
oldEl.innerHTML = html;
return oldEl;
@*/</span>
<span style="color: #003366; font-weight: bold;">var</span> newEl <span style="color: #339933;">=</span> oldEl.<span style="color: #660066;">cloneNode</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
newEl.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> html<span style="color: #339933;">;</span>
oldEl.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">replaceChild</span><span style="color: #009900;">&#40;</span>newEl<span style="color: #339933;">,</span> oldEl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009966; font-style: italic;">/* 一旦我们从 DOM 上移除老的元素，则返回新的元素引用。*/</span>
<span style="color: #000066; font-weight: bold;">return</span> newEl<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>可以直接用<code>el=replaceHtml(el, newHtml)</code>代替<code>el.innerHTML=newHtml</code>。</p>
<p>速度到底有多大提升，还得测试说话。作者提供了一个测试页面：http://stevenlevithan.com/demo/replaceHtml.html</p>
<p>此方法大大提高了 innerHTML 在 Firefox 和 Safari 上的性能。replaceHtml() 在 Firefox 2.0.0.6 里 destroy 与 replace 的速度各快了 473 倍以及 50 倍。而在 Safari 3.0.3 beta 上则是 create 100 倍，replace 50 倍。<br />
<span id="more-607"></span><br />
对于 Opera 也依然有性能提高，只是提高幅度没有上面两种浏览器惊人而已，</p>
<p>唯在 IE 中，则原始的 <strong>innerHTML </strong>的方法更效率点。</p>
<p>扩展阅读：</p>
<p>《<a target="_blank" href="http://blog.stevenlevithan.com/archives/faster-than-innerhtml">When innerHTML isn’t Fast Enoug</a>h》| 《<a target="_blank" href="http://www.dustindiaz.com/innerhtml-vs-dom-methods/">innerHTML and DOM Methods</a>》| <a target="_blank" href="http://www.planabc.net/2008/03/04/innerhtml_and_dom_methods/">原文链接</a>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=提高Firefox的innerHTML()的性能&#038; uri=http://www.js8.in/607.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=提高Firefox的innerHTML()的性能&#038;bkmk=http://www.js8.in/607.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=提高Firefox的innerHTML()的性能&#038;iu=http://www.js8.in/607.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/607.html&#038;title=提高Firefox的innerHTML()的性能" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/607.html&#038;title=提高Firefox的innerHTML()的性能" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=提高Firefox的innerHTML()的性能&#038;rurl=http://www.js8.in/607.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=提高Firefox的innerHTML()的性能&#038;url=http://www.js8.in/607.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=提高Firefox的innerHTML()的性能&#038;url=http://www.js8.in/607.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=提高Firefox的innerHTML()的性能&#038;url=http://www.js8.in/607.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/607.html" title="提高Firefox的innerHTML()的性能">http://www.js8.in/607.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/594.html" title="JS的Image对象可用于检测图片类型是否合法" rel="bookmark inlinks">JS的Image对象可用于检测图片类型是否合法</a></li>
<li><a href="http://www.js8.in/380.html" title="IE6 PNG图片不透明问题的解决方法" rel="bookmark inlinks">IE6 PNG图片不透明问题的解决方法</a></li>
<li><a href="http://www.js8.in/558.html" title="onbeforeunload与a标签在IE中的冲突bug" rel="bookmark inlinks">onbeforeunload与a标签在IE中的冲突bug</a></li>
<li><a href="http://www.js8.in/464.html" title="使用hash来实现Ajax前进后退" rel="bookmark inlinks">使用hash来实现Ajax前进后退</a></li>
<li><a href="http://www.js8.in/529.html" title="通过javascript实现整站黑白效果" rel="bookmark inlinks">通过javascript实现整站黑白效果</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/607.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用PHP把excel(xls)文件导入mysql数据库</title>
		<link>http://www.js8.in/618.html</link>
		<comments>http://www.js8.in/618.html#comments</comments>
		<pubDate>Sat, 04 Sep 2010 03:43:24 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=618</guid>
		<description><![CDATA[一个项目需要把客户提供的excel文件里面的数据导入到mysql数据库，最常用的方法就是先把xls文件导出为csv格式的文件，然后在解析csv格式的文件导入到mysql数据库。方法比较冗余，而且分好几步进行，很不方便，断桥残雪今天介绍一种方法是直接跳过csv的中间环节，直接把excel文件导入mysql数据库。]]></description>
			<content:encoded><![CDATA[<p>昨晚一个客户联系我<a href="http://www.js8.in/537.html" target='_blank' title='承接企业网站建设，企业建站工作'>做网站</a>，提出的要求是需要把客户提供的<strong>excel文件</strong>里面的数据导入到mysql数据库，最常用的方法就是先把<strong>xls</strong>文件导出为csv格式的文件，然后在解析csv格式的文件导入到<strong>mysql数据库</strong>。方法比较冗余，而且分好几步进行，很不方便，断桥残雪今天介绍一种方法是直接跳过<strong>csv</strong>的中间环节，直接把excel文件导入mysql数据库。</p>
<p>首先我们需要下载<strong>PHP-ExcelReader</strong>这是一个开源的项目，主要是来解析excel的文件，下载地址：<a target="_blank" href="http://sourceforge.net/projects/phpexcelreader" target="_blank">http://sourceforge.net/projects/phpexcelreader</a>，下载之后解压，主要用到excel文件夹里面的两个文件reader.php和oleread.php（这个文件默认的是oleread.inc，不清楚为啥，一堆e文，没看，直接改名即可）。</p>
<p>在reader.php文件中找到以下类似代码（第一行既是），改成正确的oleread.php路径即可：<code>require_once 'oleread.php';</code></p>
<p>然后新建一个php文件引入reader.php，<span id="more-618"></span>代码如下：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'Excel/reader.php'</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Spreadsheet_Excel_Reader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setOutputEncoding</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'gbk'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//此处设置编码，一般都是gbk模式</span>
&nbsp;
<span style="color: #000088;">$data</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">read</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Book1.xls'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//文件路径</span>
&nbsp;
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span> ^ <span style="color: #009900; font-weight: bold;">E_NOTICE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//这里我就只循环输出excel文件的内容了，要入库，只要把输出的地方，写一段mysql语句即可~</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$data</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sheets</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'numRows'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$j</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$data</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sheets</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'numCols'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$j</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$data</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sheets</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cells'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>,&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>注意：请不要使用PHP-ExcelReader压缩包里面的xls进行测试，<a title="断桥残雪部落格" href="http://www.js8.in" target="_blank">断桥残雪</a>发现，那个文件既是使用<strong>excel</strong>也打不开，所以是错误的。</p>
<p>断桥残雪使用上面的方法解析了一个1.4M的数据，都显示正常，所以大家可以放心使用</p>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=使用PHP把excel(xls)文件导入mysql数据库&#038; uri=http://www.js8.in/618.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=使用PHP把excel(xls)文件导入mysql数据库&#038;bkmk=http://www.js8.in/618.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=使用PHP把excel(xls)文件导入mysql数据库&#038;iu=http://www.js8.in/618.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/618.html&#038;title=使用PHP把excel(xls)文件导入mysql数据库" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/618.html&#038;title=使用PHP把excel(xls)文件导入mysql数据库" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=使用PHP把excel(xls)文件导入mysql数据库&#038;rurl=http://www.js8.in/618.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=使用PHP把excel(xls)文件导入mysql数据库&#038;url=http://www.js8.in/618.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=使用PHP把excel(xls)文件导入mysql数据库&#038;url=http://www.js8.in/618.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=使用PHP把excel(xls)文件导入mysql数据库&#038;url=http://www.js8.in/618.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/618.html" title="使用PHP把excel(xls)文件导入mysql数据库">http://www.js8.in/618.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/379.html" title="cURL常用的几个PHP函数" rel="bookmark inlinks">cURL常用的几个PHP函数</a></li>
<li><a href="http://www.js8.in/586.html" title="通过PHP批量下载图片文件" rel="bookmark inlinks">通过PHP批量下载图片文件</a></li>
<li><a href="http://www.js8.in/457.html" title="21个常用的 PHP 代码汇总" rel="bookmark inlinks">21个常用的 PHP 代码汇总</a></li>
<li><a href="http://www.js8.in/409.html" title="巧用谷歌Reader订阅最新春运信息" rel="bookmark inlinks">巧用谷歌Reader订阅最新春运信息</a></li>
<li><a href="http://www.js8.in/352.html" title="wordpress Follow5插件发布" rel="bookmark inlinks">wordpress Follow5插件发布</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/618.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>解决IE6不支持max-height的bug</title>
		<link>http://www.js8.in/606.html</link>
		<comments>http://www.js8.in/606.html#comments</comments>
		<pubDate>Fri, 03 Sep 2010 05:06:30 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=606</guid>
		<description><![CDATA[对于IE6不支持max-height属性的bug，本文通过jquery的方法来解决，原理是在IE6中可以通过设定height来达到max-height的效果. 循环所有要加max-height属性的DOM元素,判断他的scrollHeight大于你要设置的最大高度 如果超过了就通过设置height为最大高度，]]></description>
			<content:encoded><![CDATA[<p>罪恶的IE6不支持<strong>max-height</strong>属性，不过我们可以通过jQuery来解决IE6不支持max-height，<strong>jQuery</strong>的代码如下：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.entry&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">scrollHeight</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #CC0000;">500</span><span style="color: #009900;">&#41;</span>
     $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;height&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;500px&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>原理</strong>: 在IE6中可以通过设定height来达到<strong>max-height</strong>的效果. 循环所有要加max-height属性的DOM元素,判断他的scrollHeight大于你要设置的最大高度 如果超过了就通过设置height为最大高度，我这里使用的是[0]，获取的是的DOM对象，而不是jQuery对象，详细说明见：《<a href="http://www.js8.in/416.html" target="_blank">jQuery选择器使用详解</a>》</p>
<p>上面的代码还没有加入IE6的判断,完整代码如下:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span><span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">version</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;6.0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.entry&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">scrollHeight</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #CC0000;">500</span><span style="color: #009900;">&#41;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;height&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;500px&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;overflow&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;hidden&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>当然你也可以通过<strong>css表达式</strong>来实现<strong>IE6</strong>支持max-height属性</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.entry<span style="color: #00AA00;">&#123;</span>
//我烧验证woshao_985140e4b71711df9e5e000c295b2b8d
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> expression<span style="color: #00AA00;">&#40;</span> this<span style="color: #6666ff;">.scrollHeight</span> &amp;gt<span style="color: #00AA00;">;</span> <span style="color: #cc66cc;">500</span> ? <span style="color: #ff0000;">&quot;500px&quot;</span> <span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;auto&quot;</span> <span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* sets max-height for IE */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=解决IE6不支持max-height的bug&#038; uri=http://www.js8.in/606.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=解决IE6不支持max-height的bug&#038;bkmk=http://www.js8.in/606.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=解决IE6不支持max-height的bug&#038;iu=http://www.js8.in/606.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/606.html&#038;title=解决IE6不支持max-height的bug" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/606.html&#038;title=解决IE6不支持max-height的bug" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=解决IE6不支持max-height的bug&#038;rurl=http://www.js8.in/606.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=解决IE6不支持max-height的bug&#038;url=http://www.js8.in/606.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=解决IE6不支持max-height的bug&#038;url=http://www.js8.in/606.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=解决IE6不支持max-height的bug&#038;url=http://www.js8.in/606.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/606.html" title="解决IE6不支持max-height的bug">http://www.js8.in/606.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/63.html" title="jQuery插件pager修改版-更加智能" rel="bookmark inlinks">jQuery插件pager修改版-更加智能</a></li>
<li><a href="http://www.js8.in/538.html" title="javascript在光标位置插入内容" rel="bookmark inlinks">javascript在光标位置插入内容</a></li>
<li><a href="http://www.js8.in/501.html" title="IE中Image.onload失效的问题" rel="bookmark inlinks">IE中Image.onload失效的问题</a></li>
<li><a href="http://www.js8.in/620.html" title="关于wBox iFrame回调关闭问题的解决方案" rel="bookmark inlinks">关于wBox iFrame回调关闭问题的解决方案</a></li>
<li><a href="http://www.js8.in/451.html" title="jQuery Easing 动画效果扩展" rel="bookmark inlinks">jQuery Easing 动画效果扩展</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/606.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>前端开发优化总结</title>
		<link>http://www.js8.in/612.html</link>
		<comments>http://www.js8.in/612.html#comments</comments>
		<pubDate>Wed, 01 Sep 2010 02:38:21 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[前端优化]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=612</guid>
		<description><![CDATA[发现的一篇关于前端优化的文章，总结的很全面，前端是庞大的，包括HTML、CSS、Javascript、Image、Flash等等各种各样的资源。前端优化是复杂的，针对方方面面的资源都有不同的方式。本文从多个方式对前端优化进行了详细的总结]]></description>
			<content:encoded><![CDATA[<p>发现的一篇关于<strong>前端优化</strong>的文章，总结的很全面，要做到面面俱到很难，往往是想优化而没有时间去优化，就像我们公司，一个项目连着一个项目~新员工的培训都省了，还想优化前端啊，不过我真的想有机会和<a target="_blank" href="http://www.qicaisky.com/" target="_blank">老大</a>好好的整合下公司网站的前端代码~不过要把前端优化的工作放在平时的写代码中去，就不需要刻意的后期优化了。在项目开发中，后台需要搭建好框架，前端更是需要搭建好框架，并且在页面实现中得到实现，只有这样才能事半功倍。</p>
<p>前段时间简单的研究了下前端优化相关的知识，本文算是一个阶段性的总结，或者当做一个优化的参考List。</p>
<h3>前言</h3>
<p>前端是庞大的，包括HTML、CSS、Javascript、Image、Flash等等各种各样的资源。<strong>前端优化</strong>是复杂的，针对方方面面的资源都有不同的方式。那么，前端优化的目的是什么？</p>
<ol>
<li>从用户角度而言，优化能够让页面加载得更快、对用户的操作响应得更及时，能够给用户提供更为友好的体验。</li>
<li>从服务商角度而言，优化能够减少页面请求数、或者减小请求所占带宽，能够节省可观的资源。</li>
</ol>
<p>总之，恰当的优化不仅能够改善站点的用户体验并且能够节省相当的资源利用。</p>
<p>前端优化的途径有很多，按粒度大致可以分为两类，第一类是页面级别的优化，例如HTTP请求数、脚本的无阻塞加载、内联脚本的位置优化等；第二类则是代码级别的优化，例如Javascript中的DOM操作优化、CSS选择符优化、图片优化以及HTML结构优化等等。另外，本着提高投入产出比的目的，后文提到的各种优化策略大致按照投入产出比从大到小的顺序排列。</p>
<h3>一、页面级优化</h3>
<p><span id="more-612"></span><br />
<strong>1. 减少HTTP请求数</strong></p>
<p>这条策略基本上所有前端人都知道，而且也是最重要最有效的。都说要减少<strong>HTTP</strong>请求，那请求多了到底会怎么样呢？首先，每个请求都是有成本的，既包含时间成本也包含资源成本。一个完整的请求都需要经过DNS寻址、与服务器建立连接、发送数据、等待服务器响应、接收数据这样一个“漫长”而复杂的过程。时间成本就是用户需要看到或者“感受”到这个资源是必须要等待这个过程结束的，资源上由于每个请求都需要携带数据，因此每个请求都需要占用带宽。另外，由于浏览器进行并发请求的请求数是有上限的(具体参见<a target="_blank" href="http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/" target="_blank">此处</a>)，因此请求数多了以后，浏览器需要分批进行请求，因此会增加用户的等待时间，会给用户造成站点速度慢这样一个印象，即使可能用户能看到的第一屏的资源都已经请求完了，但是浏览器的进度条会一直存在。</p>
<p>减少HTTP请求数的主要途径包括：</p>
<p>(1). 从设计实现层面简化页面</p>
<p>如果你的页面像百度首页一样简单，那么接下来的规则基本上都用不着了。保持页面简洁、减少资源的使用时最直接的。如果不是这样，你的页面需要华丽的皮肤，则继续阅读下面的内容。</p>
<p>(2). 合理设置HTTP缓存</p>
<p>缓存的力量是强大的，恰当的缓存设置可以大大的减少HTTP请求。以<a target="_blank" href="http://youa.baidu.com/" target="_blank">有啊首页</a>为例，当浏览器没有缓存的时候访问一共会发出78个请求，共600多K数据（如图1.1），而当第二次访问即浏览器已缓存之后访问则仅有10个请求，共20多K数据（如图1.2）。（这里需要说明的是，如果直接F5刷新页面的话效果是不一样的，这种情况下请求数还是一样，不过被缓存资源的请求服务器是304响应，只有Header没有Body，可以节省带宽）</p>
<div id="attachment_613" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.js8.in/wp-content/uploads/2010/08/image.png"><img class="size-medium wp-image-613 " title="如图1.2" src="http://www.js8.in/wp-content/uploads/2010/08/image-300x134.png" alt="如图1.2" width="300" height="134" /></a><p class="wp-caption-text">如图1.1</p></div>
<div id="attachment_614" class="wp-caption aligncenter" style="width: 254px"><a href="http://www.js8.in/wp-content/uploads/2010/08/image-thumb1.png"><img class="size-full wp-image-614 " title="如图1.2" src="http://www.js8.in/wp-content/uploads/2010/08/image-thumb1.png" alt="如图1.2" width="244" height="92" /></a><p class="wp-caption-text">如图1.2</p></div>
<p>怎样才算合理设置？原则很简单，能缓存越多越好，能缓存越久越好。例如，很少变化的图片资源可以直接通过HTTP Header中的Expires设置一个很长的过期头；变化不频繁而又可能会变的资源可以使用Last-Modifed来做请求验证。尽可能的让资源能够在缓存中待得更久。关于HTTP缓存的具体设置和原理此处就不再详述了，有兴趣的可以参考下列文章：</p>
<p><a target="_blank" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html" target="_blank">HTTP1.1协议中关于缓存策略的描述</a></p>
<p><a target="_blank" href="http://msdn.microsoft.com/en-us/library/bb250442(VS.85).aspx" target="_blank">Fiddler HTTP Performance中关于缓存的介绍</a></p>
<p>(3). 资源合并与压缩</p>
<p>如果可以的话，尽可能的将外部的脚本、样式进行合并，多个合为一个。另外，CSS、Javascript、Image都可以用相应的工具进行压缩，压缩后往往能省下不少空间。</p>
<p>(4). CSS Sprites</p>
<p>合并CSS图片，减少请求数的又一个好办法。</p>
<p>(5). Inline Images</p>
<p>使用data: <a target="_blank" href="http://tools.ietf.org/html/rfc2397" target="_blank">URL scheme</a>的方式将图片嵌入到页面或CSS中，如果不考虑资源管理上的问题的话，不失为一个好办法。如果是嵌入页面的话换来的是增大了页面的体积，而且无法利用浏览器缓存。使用在CSS中的图片则更为理想一些。</p>
<p>(6). Lazy Load Images</p>
<p>这条策略实际上并不一定能减少HTTP请求数，但是却能在某些条件下或者页面刚加载时减少HTTP请求数。对于图片而言，在页面刚加载的时候可以只加载第一屏，当用户继续往后滚屏的时候才加载后续的图片。这样一来，假如用户只对第一屏的内容感兴趣时，那剩余的图片请求就都节省了。有啊首页曾经的做法是在加载的时候把第一屏之后的图片地址缓存在Textarea标签中，待用户往下滚屏的时候才“惰性”加载。</p>
<p><strong>2. 将外部脚本置底</strong></p>
<p>前文有谈到，浏览器是可以并发请求的，这一特点使得其能够更快的加载资源，然而外链脚本在加载时却会阻塞其他资源，例如在脚本加载完成之前，它后面的图片、样式以及其他脚本都处于阻塞状态，直到脚本加载完成后才会开始加载。如果将脚本放在比较靠前的位置，则会影响整个页面的加载速度从而影响用户体验。解决这一问题的方法有很多，在这里有比较<a target="_blank" href="http://www.stevesouders.com/blog/2009/04/27/loading-scripts-without-blocking/" target="_blank">详细的介绍</a>（<a target="_blank" href="http://varnow.org/?p=42" target="_blank">这里是译文和更详细的例子</a>），而最简单可依赖的方法就是将脚本尽可能的往后挪，减少对并发下载的影响。</p>
<p><strong>3. 异步执行inline脚本</strong></p>
<p>inline脚本对性能的影响与外部脚本相比，是有过之而无不及。首页，与外部脚本一样，inline脚本在执行的时候一样会阻塞并发请求，除此之外，由于浏览器在页面处理方面是单线程的，当inline脚本在页面渲染之前执行时，页面的渲染工作则会被推迟。简而言之，inline脚本在执行的时候，页面处于空白状态。鉴于以上两点原因，建议将执行时间较长的inline脚本异步执行，异步的方式有很多种，例如使用script元素的defer属性（存在兼容性问题和其他一些问题，例如不能使用document.write）、使用setTimeout，此外，在HTML5中引入了<a target="_blank" href="https://developer.mozilla.org/En/Using_web_workers" target="_blank">Web Workers</a>的机制，恰恰可以解决此类问题。</p>
<p><strong>4. Lazy Load Javascript</strong></p>
<p>随着<strong>Javascript</strong>框架的流行，越来越多的站点也使用起了框架。不过，一个框架往往包括了很多的功能实现，这些功能并不是每一个页面都需要的，如果下载了不需要的脚本则算得上是一种资源浪费-既浪费了带宽又浪费了执行花费的时间。目前的做法大概有两种，一种是为那些流量特别大的页面专门定制一个专用的mini版框架，另一种则是Lazy Load。<a target="_blank" href="http://developer.yahoo.com/yui/3/" target="_blank">YUI</a>则使用了第二种方式，在<strong>YUI</strong>的实现中，最初只加载核心模块，其他模块可以等到需要使用的时候才加载。</p>
<p><strong>5. 将CSS放在HEAD中</strong></p>
<p>如果将CSS放在其他地方比如BODY中，则浏览器有可能还未下载和解析到CSS就已经开始渲染页面了，这就导致页面由无CSS状态跳转到CSS状态，用户体验比较糟糕。除此之外，有些浏览器会在CSS下载完成后才开始渲染页面，如果CSS放在靠下的位置则会导致浏览器将渲染时间推迟。</p>
<p><strong>6. 异步请求Callback</strong></p>
<p>在某些页面中可能存在这样一种需求，需要使用script标签来异步的请求数据。类似：<br />
Javascript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> myCallback<span style="color: #009900;">&#40;</span>info<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">//do something here</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>HTML</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script src=&quot;http://abc.com/cb&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre></div></div>

<p>callback返回的内容:<br />
<code>myCallback('Hello world!'); </code></p>
<p>像以上这种方式直接在页面上写&lt;script&gt;对页面的性能也是有影响的，即增加了页面首次加载的负担，推迟了DOMLoaded和window.onload事件的触发时机。如果时效性允许的话，可以考虑在DOMLoaded事件触发的时候加载，或者使用setTimeout方式来灵活的控制加载的时机。</p>
<p><strong>7. 减少不必要的HTTP跳转</strong></p>
<p>对于以目录形式访问的HTTP链接，很多人都会忽略链接最后是否带’/&#8217;，假如你的服务器对此是区别对待的话，那么你也需要注意，这其中很可能隐藏了301跳转，增加了多余请求。具体参见下图，其中第一个链接是以无’/&#8217;结尾的方式访问的，于是服务器有了一次跳转。</p>
<div id="attachment_615" class="wp-caption aligncenter" style="width: 254px"><a href="http://www.js8.in/wp-content/uploads/2010/08/image-thumb2.png"><img class="size-full wp-image-615" title="图1.3" src="http://www.js8.in/wp-content/uploads/2010/08/image-thumb2.png" alt="图1.3" width="244" height="35" /></a><p class="wp-caption-text">图1.3</p></div>
<p><strong>8. 避免重复的资源请求</strong></p>
<p>这种情况主要是由于疏忽或页面由多个模块拼接而成，然后每个模块中请求了同样的资源时，会导致资源的重复请求。出现的几率不大，但是还是要注意排查，不然可能会出现如下局面，来自<a target="_blank" href="http://womai.com/" target="_blank">这里</a>。</p>
<div id="attachment_616" class="wp-caption aligncenter" style="width: 254px"><a href="http://www.js8.in/wp-content/uploads/2010/08/image-thumb3.png"><img class="size-full wp-image-616" title="图1.4" src="http://www.js8.in/wp-content/uploads/2010/08/image-thumb3.png" alt="图1.4" width="244" height="159" /></a><p class="wp-caption-text">图1.4</p></div>
<p>图1.4中，同一个JS在一个页面中请求了9次，全是200请求，当然这个算比较极端的情况了。</p>
<h3>二、代码级优化</h3>
<p><strong>1. Javascript</strong></p>
<p>(1). DOM</p>
<p>DOM操作应该是脚本中最耗性能的一类操作，例如增加、修改、删除DOM元素或者对DOM集合进行操作。如果脚本中包含了大量的DOM操作则需要注意以下几点：</p>
<p>a. HTML Collection</p>
<p>在脚本中document.images、document.forms、getElementsByTagName()返回的都是HTMLCollection类型的集合，在平时使用的时候大多将它作为数组来使用，因为它有length属性，也可以使用索引访问每一个元素。不过在访问性能上则比数组要差很多，原因是这个集合并不是一个静态的结果，它表示的仅仅是一个特定的查询，每次访问该集合时都会重新执行这个查询从而更新查询结果。所谓的“访问集合”包括读取集合的length属性、访问集合中的元素。</p>
<p>因此，当你需要遍历HTML Collection的时候，尽量将它转为数组后再访问，以提高性能。即使不转换为数组，也请尽可能少的访问它，例如在遍历的时候可以将length属性、成员保存到局部变量后再使用局部变量。</p>
<p>b. Reflow &amp; Repaint</p>
<p>除了上面一点之外，DOM操作还需要考虑浏览器的Reflow和Repaint，因为这些都是需要消耗资源的，具体的可以参加以下文章：</p>
<p><a target="_blank" href="http://varnow.org/?p=232" target="_blank"> 如何减少浏览器的repaint和reflow?</a></p>
<p><a target="_blank" href="http://blog.dynatrace.com/2009/12/12/understanding-internet-explorer-rendering-behaviour/" target="_blank"> Understanding Internet Explorer Rendering Behaviour</a></p>
<p><a target="_blank" href="http://www.mozilla.org/newlayout/doc/reflow.html" target="_blank"> Notes on HTML Reflow</a></p>
<p>(2). 慎用with</p>
<p><code>with(obj){ p = 1}; </code>代码块的行为实际上是修改了代码块中的执行环境，将obj放在了其作用域链的最前端，在with代码块中访问非局部变量是都是先从obj上开始查找，如果没有再依次按作用域链向上查找，因此使用with相当于增加了作用域链长度。而每次查找作用域链都是要消耗时间的，过长的作用域链会导致查找性能下降。</p>
<p>因此，除非你能肯定在with代码中只访问obj中的属性，否则慎用with，替代的可以使用局部变量缓存需要访问的属性。</p>
<p>(3). 避免使用eval和Function</p>
<p>每次 eval 或 Function 构造函数作用于字符串表示的源代码时，脚本引擎都需要将源代码转换成可执行代码。这是很消耗资源的操作 —— 通常比简单的函数调用慢100倍以上。</p>
<p>eval 函数效率特别低，由于事先无法知晓传给 eval 的字符串中的内容，eval在其上下文中解释要处理的代码，也就是说编译器无法优化上下文，因此只能有浏览器在运行时解释代码。这对性能影响很大。</p>
<p>Function 构造函数比eval略好，因为使用此代码不会影响周围代码；但其速度仍很慢。</p>
<p>此外，使用eval和Function也不利于Javascript压缩工具执行压缩。</p>
<p>(4). 减少作用域链查找</p>
<p>前文谈到了作用域链查找问题，这一点在循环中是尤其需要注意的问题。如果在循环中需要访问非本作用域下的变量时请在遍历之前用局部变量缓存该变量，并在遍历结束后再重写那个变量，这一点对全局变量尤其重要，因为全局变量处于作用域链的最顶端，访问时的查找次数是最多的。</p>
<p>低效率的写法：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//全局变量</span>
<span style="color: #003366; font-weight: bold;">var</span> globalVar <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> myCallback<span style="color: #009900;">&#40;</span>info<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">100000</span><span style="color: #339933;">;</span> i<span style="color: #339933;">--;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">//每次访问globalVar都需要查找到作用域链最顶端，本例中需要访问100000次</span>
globalVar <span style="color: #339933;">+=</span> i<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>更高效的写法：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//全局变量</span>
<span style="color: #003366; font-weight: bold;">var</span> globalVar <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> myCallback<span style="color: #009900;">&#40;</span>info<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">//局部变量缓存全局变量</span>
<span style="color: #003366; font-weight: bold;">var</span> localVar <span style="color: #339933;">=</span> globalVar<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">100000</span><span style="color: #339933;">;</span> i<span style="color: #339933;">--;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">//访问局部变量是最快的</span>
localVar <span style="color: #339933;">+=</span> i<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #006600; font-style: italic;">//本例中只需要访问2次全局变量</span>
globalVar <span style="color: #339933;">=</span> localVar<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>此外，要减少作用域链查找还应该减少闭包的使用。</p>
<p>(5). 数据访问</p>
<p>Javascript中的数据访问包括直接量（字符串、正则表达式）、变量、对象属性以及数组，其中对直接量和局部变量的访问是最快的，对对象属性以及数组的访问需要更大的开销。当出现以下情况时，建议将数据放入局部变量：</p>
<ol>
<li> 对任何对象属性的访问超过1次</li>
<li> 对任何数组成员的访问次数超过1次</li>
</ol>
<p>另外，还应当尽可能的减少对对象以及数组深度查找。</p>
<p>(6). 字符串拼接</p>
<p>在Javascript中使用&#8221;+&#8221;号来拼接字符串效率是比较低的，因为每次运行都会开辟新的内存并生成新的字符串变量，然后将拼接结果赋值给新变量。与之相比更为高效的做法是使用数组的join方法，即将需要拼接的字符串放在数组中最后调用其join方法得到结果。不过由于使用数组也有一定的开销，因此当需要拼接的字符串较多的时候可以考虑用此方法。</p>
<p>关于Javascript优化的更详细介绍请参考：</p>
<p><a target="_blank" href="http://www.slideshare.net/nzakas/writing-efficient-javascript" target="_blank"> Write Efficient Javascript(PPT)</a></p>
<p><a target="_blank" href="http://dev.opera.com/articles/view/efficient-javascript/" target="_blank"> Efficient JavaScript</a></p>
<p><a title="javascript高效简洁代码的编写及优化技巧- 断桥残雪部落格" href="http://www.js8.in/350.html" target="_blank">javascript高效简洁代码的编写及优化技巧</a></p>
<p><strong>2. CSS选择符</strong></p>
<p>在大多数人的观念中，都觉得浏览器对CSS选择符的解析式从左往右进行的，例如</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#toc</span> A <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#444</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>这样一个选择符，如果是从右往左解析则效率会很高，因为第一个ID选择基本上就把查找的范围限定了，但实际上浏览器对选择符的解析是从右往左进行的。如上面的选择符，浏览器必须遍历查找每一个A标签的祖先节点，效率并不像之前想象的那样高。根据浏览器的这一行为特点，在写选择符的时候需要注意很多事项，有人已经一一列举了，<a target="_blank" href="https://developer.mozilla.org/en/Writing_Efficient_CSS" target="_blank">详情参考此处</a>。</p>
<p><strong>3. HTML</strong></p>
<p>对HTML本身的优化现如今也越来越多的受人关注了，详情可以参见这篇<a target="_blank" rel="nofollow" href="http://varnow.org/?p=249" target="_blank">总结性文章</a>。</p>
<p><strong>4. Image压缩</strong></p>
<p>图片压缩是个技术活，不过现如今这方面的工具也非常多，压缩之后往往能带来不错的效果，具体的压缩原理以及方法在《Even Faster Web Sites》第10章有很详细的介绍，有兴趣的可以去看看。</p>
<h3>总结</h3>
<p>本文从页面级以及代码级两个粒度对<strong>前端优化</strong>的各种方式做了一个总结，这些方法基本上都是前端开发人员在开发的过程中可以借鉴和实践的，除此之外，完整的前端优化还应该包括很多其他的途径，例如CDN、Gzip、多域名、无Cookie服务器等等，由于对于开发人员的可操作性并不强大，在此也就不多叙述了，详细的可以参考<a target="_blank" href="http://developer.yahoo.com/performance/rules.html" target="_blank">Yahoo</a>和<a target="_blank" href="http://code.google.com/speed/page-speed/docs/rules_intro.html" target="_blank">Google</a>的这些“金科玉律”。</p>
<p>原文链接：http://varnow.org/?p=260</p>
<p><div id="attachment_590" class="wp-caption aligncenter" style="width: 157px"><a target="_blank" href="http://feed.feedsky.com/r57c"><img class="size-full wp-image-590" title="断桥残雪部落格最新的订阅地址" src="http://www.js8.in/wp-content/uploads/2010/08/logo_147x47.gif" alt="断桥残雪部落格最新的订阅地址" width="147" height="47" /></a><p class="wp-caption-text">感觉不错,订阅它</p></div>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=前端开发优化总结&#038; uri=http://www.js8.in/612.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=前端开发优化总结&#038;bkmk=http://www.js8.in/612.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=前端开发优化总结&#038;iu=http://www.js8.in/612.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/612.html&#038;title=前端开发优化总结" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/612.html&#038;title=前端开发优化总结" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=前端开发优化总结&#038;rurl=http://www.js8.in/612.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=前端开发优化总结&#038;url=http://www.js8.in/612.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=前端开发优化总结&#038;url=http://www.js8.in/612.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=前端开发优化总结&#038;url=http://www.js8.in/612.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/612.html" title="前端开发优化总结">http://www.js8.in/612.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/607.html" title="提高Firefox的innerHTML()的性能" rel="bookmark inlinks">提高Firefox的innerHTML()的性能</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/612.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>关于jQuery ready()方法一些用法解释</title>
		<link>http://www.js8.in/603.html</link>
		<comments>http://www.js8.in/603.html#comments</comments>
		<pubDate>Tue, 31 Aug 2010 02:27:27 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jQuery1.4]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=603</guid>
		<description><![CDATA[本文介绍了jQuery的ready几种常用的方法，以及在使用中注意的问题，jQuery的ready方法作用相当于我们的body onload，是当页面DOM准备就绪的时候才运行的代码，最常用的就是在DOM渲染加载之前，先给document绑定ready事件，然后当页面DOM都准备好之后才运行这个事件。]]></description>
			<content:encoded><![CDATA[<p>jQuery的<strong>ready</strong>方法的是开发中经常用到的，作用相当于我们的body onload，是当页面DOM准备就绪的时候才运行的代码，最常用的就是在DOM渲染加载之前，先给document绑定ready事件，然后当页面DOM都准备好之后才运行这个事件。<br />
关于<strong>jQuery</strong>的ready有以下几种用法</p>
<h3>最常用也是最标准的ready方法</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>简写的jQuery ready()</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>这是因为<strong>jQuery</strong>的选择器第一个参数假如为空，那么默认的是<strong>document</strong><br />
<span id="more-603"></span></p>
<h3>不建议使用的ready()方法</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span>handler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>在<a target="_blank" href="http://jquery14.com/day-01/jquery-14" target="_blank">jQuery1.4发布公告</a>中提到了：在jQuery1.4中仍然保留这种方法，但是不推荐使用，并且jQuery1.3的ready会返回一个jQuery的对象，而1.4中则不会又返回</p>
<h3>解决jQuery（$）库冲突的ready方法</h3>
<p>这一种方式一般用在处理jQuery的$和别的<strong>库冲突</strong>的时候用的,可以通过<strong><code>jQuery.noConflict()</code></strong>这个方法,我们就可以直接在代码中通过jQuery来代替$来使用,但又习惯了使用$怎么办?看下面的代码:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
jQuery<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#ready1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   <span style="color: #006600; font-style: italic;">//这样我们就可以使用$了</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>后记</h3>
<p>一般在开发中<a href="http://www.js8.in">断桥残雪</a>是不会推荐使用jQuery的ready方法的，因为绑定ready事件之后，jQuery需要添加<strong>DOMContentLoaded</strong>监听事件，对于页面加载渲染是有一定影响的，所以建议我们在逼不得已的情况下才使用jQuery的ready。</p>
<p>在实际开发中我推荐把ready中要执行的函数放在DOM的HTML代码之后，也就是当DOM渲染过去之后再执行handler，或者把代码直接放在页面的末尾</p>
<p><div id="attachment_590" class="wp-caption aligncenter" style="width: 157px"><a target="_blank" href="http://feed.feedsky.com/r57c"><img class="size-full wp-image-590" title="断桥残雪部落格最新的订阅地址" src="http://www.js8.in/wp-content/uploads/2010/08/logo_147x47.gif" alt="断桥残雪部落格最新的订阅地址" width="147" height="47" /></a><p class="wp-caption-text">订阅更“健康”</p></div><br />
<span style="display:none">woshao_985140e4b71711df9e5e000c295b2b8d</span>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=关于jQuery ready()方法一些用法解释&#038; uri=http://www.js8.in/603.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=关于jQuery ready()方法一些用法解释&#038;bkmk=http://www.js8.in/603.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=关于jQuery ready()方法一些用法解释&#038;iu=http://www.js8.in/603.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/603.html&#038;title=关于jQuery ready()方法一些用法解释" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/603.html&#038;title=关于jQuery ready()方法一些用法解释" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=关于jQuery ready()方法一些用法解释&#038;rurl=http://www.js8.in/603.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=关于jQuery ready()方法一些用法解释&#038;url=http://www.js8.in/603.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=关于jQuery ready()方法一些用法解释&#038;url=http://www.js8.in/603.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=关于jQuery ready()方法一些用法解释&#038;url=http://www.js8.in/603.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/603.html" title="关于jQuery ready()方法一些用法解释">http://www.js8.in/603.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/337.html" title="jQuery浏览器判断一个bug，以及修改建议" rel="bookmark inlinks">jQuery浏览器判断一个bug，以及修改建议</a></li>
<li><a href="http://www.js8.in/464.html" title="使用hash来实现Ajax前进后退" rel="bookmark inlinks">使用hash来实现Ajax前进后退</a></li>
<li><a href="http://www.js8.in/620.html" title="关于wBox iFrame回调关闭问题的解决方案" rel="bookmark inlinks">关于wBox iFrame回调关闭问题的解决方案</a></li>
<li><a href="http://www.js8.in/346.html" title="Wordpress Follow5 插件开发日记—插件后台Ajax应用及jQuery的使用" rel="bookmark inlinks">Wordpress Follow5 插件开发日记—插件后台Ajax应用及jQuery的使用</a></li>
<li><a href="http://www.js8.in/416.html" title="jQuery选择器使用详解" rel="bookmark inlinks">jQuery选择器使用详解</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/603.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JS的Image对象可用于检测图片类型是否合法</title>
		<link>http://www.js8.in/594.html</link>
		<comments>http://www.js8.in/594.html#comments</comments>
		<pubDate>Mon, 30 Aug 2010 07:42:35 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[前段]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=594</guid>
		<description><![CDATA[项目中假如碰到了上传图片文件时，需要在后台加检测程序，判断图片类型是否合法，以防止一些非法的文件上传，如果对js的Image对象比较熟悉我们可以使用下面的方法在前端层次上检查下图片类型是否合法。]]></description>
			<content:encoded><![CDATA[<p>项目中假如碰到了上传图片文件时，需要在后台加检测程序，判断图片类型是否合法，以防止一些非法的文件上传，如果对js的<strong>Image</strong>对象比较熟悉我们可以使用下面的方法在<strong>前端</strong>层次上检查下图片类型是否合法。</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">       <span style="color: #003366; font-weight: bold;">var</span> img <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        img.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'load'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        img.<span style="color: #000066;">onerror</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'error'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        img.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'logo.png'</span><span style="color: #339933;">;</span></pre></div></div>

<p><span id="more-594"></span><br />
这样假如我们上传的是一张虽然文件的扩展名为png，但是实际上是php的文件，就会出现<code>alert</code></p>
<p><a href="http://www.js8.in">断桥残雪</a>的另外两篇关于<strong>javascript</strong>的image对象的文章：《<a href="http://www.js8.in/569.html" target="_blank">IE中多帧GIF可以触发多次Image().load事件</a>》、《<a href="http://www.js8.in/501.html"  target="_blank">IE中Image.onload失效的问题</a>》</p>
<p><div id="attachment_590" class="wp-caption aligncenter" style="width: 157px"><a target="_blank" href="http://feed.feedsky.com/r57c"><img class="size-full wp-image-590" title="断桥残雪部落格最新的订阅地址" src="http://www.js8.in/wp-content/uploads/2010/08/logo_147x47.gif" alt="断桥残雪部落格最新的订阅地址" width="147" height="47" /></a><p class="wp-caption-text">订阅断桥残雪部落格</p></div>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=JS的Image对象可用于检测图片类型是否合法&#038; uri=http://www.js8.in/594.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=JS的Image对象可用于检测图片类型是否合法&#038;bkmk=http://www.js8.in/594.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=JS的Image对象可用于检测图片类型是否合法&#038;iu=http://www.js8.in/594.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/594.html&#038;title=JS的Image对象可用于检测图片类型是否合法" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/594.html&#038;title=JS的Image对象可用于检测图片类型是否合法" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=JS的Image对象可用于检测图片类型是否合法&#038;rurl=http://www.js8.in/594.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=JS的Image对象可用于检测图片类型是否合法&#038;url=http://www.js8.in/594.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=JS的Image对象可用于检测图片类型是否合法&#038;url=http://www.js8.in/594.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=JS的Image对象可用于检测图片类型是否合法&#038;url=http://www.js8.in/594.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/594.html" title="JS的Image对象可用于检测图片类型是否合法">http://www.js8.in/594.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/558.html" title="onbeforeunload与a标签在IE中的冲突bug" rel="bookmark inlinks">onbeforeunload与a标签在IE中的冲突bug</a></li>
<li><a href="http://www.js8.in/311.html" title="关于Ajax在浏览器中产生前进后退的实现方法" rel="bookmark inlinks">关于Ajax在浏览器中产生前进后退的实现方法</a></li>
<li><a href="http://www.js8.in/466.html" title="javascript获取光标位置以及设置光标位置" rel="bookmark inlinks">javascript获取光标位置以及设置光标位置</a></li>
<li><a href="http://www.js8.in/416.html" title="jQuery选择器使用详解" rel="bookmark inlinks">jQuery选择器使用详解</a></li>
<li><a href="http://www.js8.in/408.html" title="JavaScript跨浏览器的添加删除事件绑定函数" rel="bookmark inlinks">JavaScript跨浏览器的添加删除事件绑定函数</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/594.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ubuntu安装NVidia驱动</title>
		<link>http://www.js8.in/598.html</link>
		<comments>http://www.js8.in/598.html#comments</comments>
		<pubDate>Sun, 29 Aug 2010 13:55:40 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[软件心得]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[驱动]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=598</guid>
		<description><![CDATA[本文介绍了Ubuntu安装NVidia驱动的两种方法，一种是通过安装源命令行直接安装，一种是从NVidia官方下载最新的驱动支持程序，手工安装，安装NVidia驱动之后，就不会出现拖尾、晃眼等显卡驱动的常见问题了]]></description>
			<content:encoded><![CDATA[<p>我的本本安装了最新版的<strong>Ubuntu </strong>10.04，安装过程一切顺利，安装完了使用的显卡驱动是官方默认的，可是本本屏幕十分晃眼，而且有拖尾的现象，于是决定安装显卡驱动，本本的显卡是<strong>NviDIA </strong>G310M的，在Ubuntu官方论坛找到了两种安装的方法</p>
<h3>Ubuntu安装NVidia驱动方法一</h3>
<p>从安装源开始安装，首先需要卸载旧的显卡驱动程序，然后在终端依次输入以下命令：</p>
<blockquote><p>sudo apt-get install nvidia-current<br />
sudo update-alternatives &#8211;config gl_conf<br />
sudo ldconfig<br />
sudo nvidia-xconfig<br />
sudo reboot</p></blockquote>
<p>方法的优点是，简单，不需要过多的人工干预，但是这种方法安装的<strong>显卡驱动</strong>对于我的本本来说还是有拖尾问题，无奈之下只好卸载，按照第二种方法，从官方下载最新的驱动程序手工安装NVidia驱动<br />
<span id="more-598"></span></p>
<h3>Ubuntu安装NVidia驱动方法二</h3>
<blockquote><p><code>sudo apt-get --purge remove xserver-xorg-video-nouveau</code><br />
ctrl+alt+F1进入文本模式,关闭gdm<br />
<code>sudo /etc/init.d/gdm stop</code><br />
<code>sudo rmmod</code><br />
安装驱动<br />
<code>sudo sh 驱动路径.run</code></p></blockquote>
<p>第二种方法安装成功，<strong>显卡</strong>明显好用多了，可是又遇到了一个问题，就是开机的时候显卡驱动似乎没有加载，因为开机的画面显得很粗糙，而登陆之后就一切正常了，不知道何原因，求解ing</p>
<p><div id="attachment_590" class="wp-caption aligncenter" style="width: 157px"><a target="_blank" href="http://feed.feedsky.com/r57c"><img class="size-full wp-image-590" title="断桥残雪部落格最新的订阅地址" src="http://www.js8.in/wp-content/uploads/2010/08/logo_147x47.gif" alt="断桥残雪部落格最新的订阅地址" width="147" height="47" /></a><p class="wp-caption-text">订阅断桥残雪部落格</p></div>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=Ubuntu安装NVidia驱动&#038; uri=http://www.js8.in/598.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=Ubuntu安装NVidia驱动&#038;bkmk=http://www.js8.in/598.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=Ubuntu安装NVidia驱动&#038;iu=http://www.js8.in/598.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/598.html&#038;title=Ubuntu安装NVidia驱动" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/598.html&#038;title=Ubuntu安装NVidia驱动" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=Ubuntu安装NVidia驱动&#038;rurl=http://www.js8.in/598.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=Ubuntu安装NVidia驱动&#038;url=http://www.js8.in/598.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=Ubuntu安装NVidia驱动&#038;url=http://www.js8.in/598.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=Ubuntu安装NVidia驱动&#038;url=http://www.js8.in/598.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/598.html" title="Ubuntu安装NVidia驱动">http://www.js8.in/598.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>随机文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/564.html" title="Google Map API教程之使用GControl对象在地图上添加control按钮" rel="bookmark inlinks">Google Map API教程之使用GControl对象在地图上添加control按钮</a></li>
<li><a href="http://www.js8.in/454.html" title="jQuery 1.4的十五大新功能实例精讲" rel="bookmark inlinks">jQuery 1.4的十五大新功能实例精讲</a></li>
<li><a href="http://www.js8.in/594.html" title="JS的Image对象可用于检测图片类型是否合法" rel="bookmark inlinks">JS的Image对象可用于检测图片类型是否合法</a></li>
<li><a href="http://www.js8.in/412.html" title="PHP生成RSS类：RSS.class.php" rel="bookmark inlinks">PHP生成RSS类：RSS.class.php</a></li>
<li><a href="http://www.js8.in/448.html" title="png在IE6下透明的几种方法" rel="bookmark inlinks">png在IE6下透明的几种方法</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/598.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告</title>
		<link>http://www.js8.in/597.html</link>
		<comments>http://www.js8.in/597.html#comments</comments>
		<pubDate>Sun, 29 Aug 2010 02:04:02 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[软件心得]]></category>
		<category><![CDATA[迅雷7]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=597</guid>
		<description><![CDATA[本文介绍最新版的迅雷7绿化方法，并且去除了多余的广告，破解了会员功能限制，去掉迅雷资讯，添加了新的绿化工具，提供最新版迅雷7的下载地址，使用方法]]></description>
			<content:encoded><![CDATA[<div id="attachment_596" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.js8.in/wp-content/uploads/2010/08/344_2272307_e6babf479f7cf6c.jpg"><img class="size-medium wp-image-596" title="迅雷7截图" src="http://www.js8.in/wp-content/uploads/2010/08/344_2272307_e6babf479f7cf6c-300x208.jpg" alt="迅雷7截图" width="300" height="208" /></a><p class="wp-caption-text">迅雷7截图</p></div>
<p>在<a target="_blank" title="迅雷7起航版一键破解--让非会员也可免费体验" href="http://www.js8.in/589.html " target="_blank">上一篇文章</a>介绍了<strong>迅雷7</strong>的起航版<strong>破解</strong>方法，今天又发现一个最新的绿色<strong>去广告</strong>版本，就转发到<a title="断桥残雪部落格" href="http://js8.in" target="_blank">我的博客</a>，需要的赶紧下载吧~</p>
<ol>
<li>去掉了广告</li>
<li>去掉了那个烦人的迅雷修复工具</li>
<li>可选择免资格登录登录</li>
<li>去掉<strong>迅雷</strong>资讯</li>
<li>添加了个绿化工具(见附件)</li>
<li>注意：绿化工具可能存在误报情况，尤其是360</li>
</ol>
<h3>使用方法</h3>
<p>打开 &#8220;Program&#8221;目录下的&#8221;<strong>Thunder</strong>&#8220;文件即可<br />
如果没有内测资格的把&#8221;XLUser{BANNED}X&#8221;压缩包里面的&#8221;XLUser{BANNED}X免资格登录.dll&#8221;重命名并为替换&#8221;XLUser{BANNED}X.dll&#8221;任意用户名密码可以登录，会显示一直在登录中<br />
<span id="more-597"></span></p>
<h3>下载地址</h3>
<p><a target="_blank" title="迅雷7下载地址" href="http://u.115.com/file/f26fa04a18" target="_blank">http://u.115.com/file/f26fa04a18</a></p>
<p><div id="attachment_590" class="wp-caption aligncenter" style="width: 157px"><a target="_blank" href="http://feed.feedsky.com/r57c"><img class="size-full wp-image-590" title="断桥残雪部落格最新的订阅地址" src="http://www.js8.in/wp-content/uploads/2010/08/logo_147x47.gif" alt="断桥残雪部落格最新的订阅地址" width="147" height="47" /></a><p class="wp-caption-text">订阅断桥残雪部落格</p></div>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告&#038; uri=http://www.js8.in/597.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告&#038;bkmk=http://www.js8.in/597.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告&#038;iu=http://www.js8.in/597.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/597.html&#038;title=迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/597.html&#038;title=迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告&#038;rurl=http://www.js8.in/597.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告&#038;url=http://www.js8.in/597.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告&#038;url=http://www.js8.in/597.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告&#038;url=http://www.js8.in/597.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/597.html" title="迅雷7(Thunder7) 最新版下载地址&#8211;绿化安装去广告">http://www.js8.in/597.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/589.html" title="迅雷7起航版一键破解--让非会员也可免费体验" rel="bookmark inlinks">迅雷7起航版一键破解--让非会员也可免费体验</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/597.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
