<?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>三水清IE6</title>
	<atom:link href="http://js8.in/tag/ie6/feed" rel="self" type="application/rss+xml" />
	<link>http://js8.in</link>
	<description>专注前端开发,分享Javascript/CSS/PHP等Web前端开发技巧</description>
	<lastBuildDate>Wed, 08 Feb 2012 11:59:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IE6中a标签触发图片和ajax请求被abort</title>
		<link>http://js8.in/944.html</link>
		<comments>http://js8.in/944.html#comments</comments>
		<pubDate>Sat, 04 Feb 2012 07:28:10 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[web前端开发]]></category>
		<category><![CDATA[abort]]></category>
		<category><![CDATA[a标签]]></category>
		<category><![CDATA[IE6]]></category>

		<guid isPermaLink="false">http://js8.in/?p=944</guid>
		<description><![CDATA[IE6 a标签的请求被abort的原因
最近项目中掉进IE6 a标签abort两次坑，第一次是a标签绑定一个事件，href='javascript:;'这样a标签触发了事件，切换验证码图片，结果验证码图片总是显示不出来，通过抓包显示状态为abort。其实这个的原因可以从IE6中a标签执行顺序说起，IE6中a标签执行onclick在执行默认事件（即href跳转）之前，当触发了绑定的事件之后，那么处理完事件之后，如果不return false或者阻止默认事件，则会继续执行href跳转，IE6会认为页面跳转到其他页面或者页面重新刷新，则abort之前onclick事件中的请求。

所以当onclick时，做出的获取最新验证码图片的请求，会因为下一步href的触发而abort。同时，如果你在a绑定的事件中做ajax请求，那么也会被无情的abort。
IE6 a标签的请求被abort的解决方案
解决的方法就是在onclick或者绑定事件中return false来阻止a标签跳转的默认事件。
例如下面的代码：

&#60;a href=&#34;javascript:void(0)&#34; onclick=&#34;fn();return false;&#34;&#62;Test&#60;/a&#62;

或者你也可以给a标签的href写成“#”，即当前页面的锚点，这样页面就不会跳转，自然不会abort请求。
最好的方式还是两种都用，保险！

声明：文章未声明为原创文章，本文链接 http://js8.in/944.html. 转载请注明转自 JS8.IN ™
随机文章

最新版wBox 解决IE6 背景太小bug
IE6 PNG图片不透明问题的解决方法
使用webbench做压力测试
查看自己是否在对方QQ好友中最简单的方法
Javascript事件触发列表与详解
Ubuntu安装Samba实现跟windows文件共享
发布WordPress来访者天气预报插件
谷歌500元免费AdWords广告费申请第二步


© 三水清 for 三水清, 2012. &#124;
No comment &#124;在微博关注我：@清-三水清
收藏到：
人人网 &#124; 豆瓣 &#124; 开心网 &#124; QQ书签 &#124; 新浪微博 &#124; 腾讯微博

Post tags: abort, a标签, IE6
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F944.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6背景图片不缓存的BUG" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F557.html&from=http%3A%2F%2Fjs8.in%2F944.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://hi.csdn.net/attachment/201104/11/0_1302522572HMK6.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6背景图片不缓存的BUG</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6 PNG图片不透明问题的解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F380.html&from=http%3A%2F%2Fjs8.in%2F944.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/01/2770440.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6 PNG图片不透明问题的解决方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6下javascript不能隐藏select标签的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&from=http%3A%2F%2Fjs8.in%2F944.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987937.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6下javascript不能隐藏select标签的bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<h2>IE6 a标签的请求被abort的原因</h2>
<p>最近项目中掉进IE6 a标签abort两次坑，第一次是a标签绑定一个事件，<code>href='javascript:;'</code>这样a标签触发了事件，切换验证码图片，结果验证码图片总是显示不出来，通过抓包显示状态为<strong>abort</strong>。其实这个的原因可以从IE6中a标签执行顺序说起，IE6中a标签执行onclick在执行默认事件（即href跳转）之前，当触发了绑定的事件之后，那么处理完事件之后，如果不<code>return false</code>或者阻止默认事件，则会继续执行href跳转，IE6会认为页面跳转到其他页面或者页面重新刷新，则abort之前<strong>onclick</strong>事件中的请求。<br />
<span id="more-944"></span></p>
<p>所以当onclick时，做出的获取最新验证码图片的请求，会因为下一步href的触发而abort。同时，如果你在a绑定的事件中做ajax请求，那么也会被无情的<code>abort</code>。</p>
<h2>IE6 a标签的请求被abort的解决方案</h2>
<p>解决的方法就是在onclick或者绑定事件中<code>return false</code>来阻止a标签跳转的默认事件。<br />
例如下面的代码：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;javascript:void(0)&quot; onclick=&quot;fn();return false;&quot;&gt;Test&lt;/a&gt;</pre></div></div>

<p>或者你也可以给a标签的href写成“#”，即当前页面的锚点，这样页面就不会跳转，自然不会abort请求。</p>
<p>最好的方式还是两种都用，保险！
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/944.html" title="IE6中a标签触发图片和ajax请求被abort">http://js8.in/944.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/343.html" title="CSS 3.0 参考手册 (中文版)下载" rel="bookmark inlinks">CSS 3.0 参考手册 (中文版)下载</a></li>
<li><a href="http://js8.in/539.html" title="jQuery弹出框插件wBox 1.0正式发布" rel="bookmark inlinks">jQuery弹出框插件wBox 1.0正式发布</a></li>
<li><a href="http://js8.in/527.html" title="断桥残雪爱墙IE发布祝福bug更新" rel="bookmark inlinks">断桥残雪爱墙IE发布祝福bug更新</a></li>
<li><a href="http://js8.in/31.html" title="08.11.15" rel="bookmark inlinks">08.11.15</a></li>
<li><a href="http://js8.in/552.html" title="2010年世界杯比赛时间表-北京时间" rel="bookmark inlinks">2010年世界杯比赛时间表-北京时间</a></li>
<li><a href="http://js8.in/446.html" title="谷歌要退出中国大陆市场？！" rel="bookmark inlinks">谷歌要退出中国大陆市场？！</a></li>
<li><a href="http://js8.in/342.html" title="php、js两种不同方式根据关键词返回经纬度接口【基于Google map API】" rel="bookmark inlinks">php、js两种不同方式根据关键词返回经纬度接口【基于Google map API】</a></li>
<li><a href="http://js8.in/49.html" title="Dedecms技巧—屏蔽禁用词语，垃圾留言过滤功能" rel="bookmark inlinks">Dedecms技巧—屏蔽禁用词语，垃圾留言过滤功能</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2012. |
<a href="http://js8.in/944.html#comments">No comment</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/abort" rel="tag">abort</a>, <a href="http://js8.in/tag/a%e6%a0%87%e7%ad%be" rel="tag">a标签</a>, <a href="http://js8.in/tag/ie6" rel="tag">IE6</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F944.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6背景图片不缓存的BUG" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F557.html&from=http%3A%2F%2Fjs8.in%2F944.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://hi.csdn.net/attachment/201104/11/0_1302522572HMK6.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6背景图片不缓存的BUG</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6 PNG图片不透明问题的解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F380.html&from=http%3A%2F%2Fjs8.in%2F944.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/01/2770440.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6 PNG图片不透明问题的解决方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6下javascript不能隐藏select标签的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&from=http%3A%2F%2Fjs8.in%2F944.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987937.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6下javascript不能隐藏select标签的bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/944.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE6中javascript文件开启Gzip出现代码不执行情况</title>
		<link>http://js8.in/902.html</link>
		<comments>http://js8.in/902.html#comments</comments>
		<pubDate>Tue, 15 Nov 2011 12:25:23 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://js8.in/?p=902</guid>
		<description><![CDATA[今天处理IE6下的一个bug，经过调试才发现是javascript文件文件总是执行不了，后来中午吃完饭回来才想起以前同事遇见的html中的javascript不可以执行的问题，怀疑是gzip的原因，此次的问题就是因为动态加载javascript文件导致代码不执行，经过研究发现gzip压缩过的javascript文件，如果header里Cache-Control 数据有no-cache, no-store，就会出现IE6中js代码不执行的问题。下面是转发的文章内容：
IE6下面调用开启了gzip压缩Javascript的时候，时常会碰到无法执行的情况，有可能是src调用，有可能是ajax调用，其它的浏览器工作正常，唯独IE6不能正常工作。
出现这个BUG的状况如下：

用户使用IE6浏览器
服务器没有设置 被请求文件(javascript) expires, cache-control.
服务器端开启了chunked encoding模式
通过javascrip的src调用方式或者ajax请求javascript文件
有可能是通过php生成的javascript文件
服务器端开启了gzip压缩

解决这个问题，我们要在服务器的cache-control和expires 头信息上做点工作。
经过测试，header头信息如下的gzip压缩过的javascript调用可以正常工作。
Cache-Control:maxage=1
Connection:keep-alive
Content-Encoding:gzip
Content-Type:application/x-javascript;charset=GBK
Date:Wed, 01 Dec 2010 01:24:07 GMT
Expires:Wed, 01 Dec 2010 01:24:08 GMT
Pragma:public
Server:nginx
Transfer-Encoding:chunked
分析上面的头信息，我们可以注意到：

cache-control必须要设置成maxage=time的格式，maxage是指定缓存生效时间，1为1秒
Expires必须要设置，它的时间稍大于Date即可，Date是页面请求时间，Expires是过期时间
Pragma设置为public


设置好了这两个参数，一般就可以了。
在nginx服务器端，我们需要对服务器配置：
location ~* \.(ico&#124;css&#124;js&#124;png&#124;jpeg&#124;jpg&#124;gif&#124;rar&#124;zip&#124;7z&#124;gz&#124;pdf) {
expires 1d;
}
如果javascript文件是由PHP生成的，我们就需要利用php来输出header控制了。

&#60;?php
$expires = 1;
header&#40;&#34;Pragma: public&#34;&#41;;
header&#40;&#34;Cache-Control: maxage=&#34;.$expires&#41;;
header&#40;'Expires: ' . gmdate&#40;'D, d M Y H:i:s', time&#40;&#41;+$expires&#41; . ' GMT'&#41;;
header&#40;&#34;Content-Type: application/x-javascript;charset=GBK\n&#34;&#41;;

实际应用中，需要灵活配置，Javascript文件，请尽可能通过服务器发送header头，PHP生成javascript文件，效率本来就不高，再加上额外需要输入header头，更是得不偿失。

声明：文章未声明为原创文章，本文链接 http://js8.in/902.html. 转载请注明转自 JS8.IN ™
随机文章

前端开发常见图片格式详解
关于jQuery ready()方法一些用法解释
前端开发优化总结
万众期待的Ajax评论发布啦-dedecms扩展工具
javascript继承的写法
王老师突然问：考研吗？
如何写出高质量的Javascript代码
chrome扩展应用开发教程之开发chrome应用基础


© 三水清 for 三水清, 2011. &#124;
8 comments &#124;在微博关注我：@清-三水清
收藏到：
人人网 &#124; 豆瓣 &#124; 开心网 &#124; [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F902.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F902.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F902.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6下javascript不能隐藏select标签的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&from=http%3A%2F%2Fjs8.in%2F902.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987937.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6下javascript不能隐藏select标签的bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>今天处理IE6下的一个bug，经过调试才发现是<strong>javascript</strong>文件文件总是执行不了，后来中午吃完饭回来才想起以前同事遇见的html中的javascript不可以执行的问题，怀疑是gzip的原因，此次的问题就是因为动态加载javascript文件导致代码不执行，经过研究发现gzip压缩过的javascript文件，如果header里Cache-Control 数据有no-cache, no-store，就会出现IE6中js代码不执行的问题。下面是转发的文章内容：</p>
<p>IE6下面调用开启了gzip压缩Javascript的时候，时常会碰到无法执行的情况，有可能是src调用，有可能是ajax调用，其它的浏览器工作正常，唯独IE6不能正常工作。<br />
出现这个BUG的状况如下：</p>
<ol>
<li>用户使用IE6浏览器</li>
<li>服务器没有设置 被请求文件(javascript) expires, cache-control.</li>
<li>服务器端开启了chunked encoding模式</li>
<li>通过javascrip的src调用方式或者ajax请求javascript文件</li>
<li>有可能是通过php生成的javascript文件</li>
<li>服务器端开启了gzip压缩</li>
</ol>
<p>解决这个问题，我们要在服务器的cache-control和expires 头信息上做点工作。<br />
经过测试，header头信息如下的gzip压缩过的javascript调用可以正常工作。</p>
<blockquote><p>Cache-Control:maxage=1<br />
Connection:keep-alive<br />
Content-Encoding:gzip<br />
Content-Type:application/x-javascript;charset=GBK<br />
Date:Wed, 01 Dec 2010 01:24:07 GMT<br />
Expires:Wed, 01 Dec 2010 01:24:08 GMT<br />
Pragma:public<br />
Server:nginx<br />
Transfer-Encoding:chunked</p></blockquote>
<p>分析上面的头信息，我们可以注意到：</p>
<ol>
<li>cache-control必须要设置成maxage=time的格式，maxage是指定缓存生效时间，1为1秒</li>
<li>Expires必须要设置，它的时间稍大于Date即可，Date是页面请求时间，Expires是过期时间</li>
<li>Pragma设置为public</li>
</ol>
<p><span id="more-902"></span><br />
设置好了这两个参数，一般就可以了。</p>
<p>在nginx服务器端，我们需要对服务器配置：</p>
<blockquote><p>location ~* \.(ico|css|js|png|jpeg|jpg|gif|rar|zip|7z|gz|pdf) {<br />
expires 1d;<br />
}</p></blockquote>
<p>如果javascript文件是由PHP生成的，我们就需要利用php来输出header控制了。</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: #000088;">$expires</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Pragma: public&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control: maxage=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$expires</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Expires: '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">gmdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'D, d M Y H:i:s'</span><span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #000088;">$expires</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' GMT'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: application/x-javascript;charset=GBK<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>实际应用中，需要灵活配置，Javascript文件，请尽可能通过服务器发送header头，PHP生成javascript文件，效率本来就不高，再加上额外需要输入header头，更是得不偿失。
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/902.html" title="IE6中javascript文件开启Gzip出现代码不执行情况">http://js8.in/902.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/764.html" title="nodejs教程：配置nodejs.exe的windows目录结构" rel="bookmark inlinks">nodejs教程：配置nodejs.exe的windows目录结构</a></li>
<li><a href="http://js8.in/526.html" title="Ubuntu安装Samba实现跟windows文件共享" rel="bookmark inlinks">Ubuntu安装Samba实现跟windows文件共享</a></li>
<li><a href="http://js8.in/465.html" title="七大让WordPress后台管理界面更漂亮的WP插件" rel="bookmark inlinks">七大让WordPress后台管理界面更漂亮的WP插件</a></li>
<li><a href="http://js8.in/691.html" title="拿福能中国千人挑战活动" rel="bookmark inlinks">拿福能中国千人挑战活动</a></li>
<li><a href="http://js8.in/553.html" title="解决IE6 select z-index无效，遮挡div的bug" rel="bookmark inlinks">解决IE6 select z-index无效，遮挡div的bug</a></li>
<li><a href="http://js8.in/934.html" title="javascript contains方法来判断元素包含关系" rel="bookmark inlinks">javascript contains方法来判断元素包含关系</a></li>
<li><a href="http://js8.in/644.html" title="利用google博客的ping服务接口API加快网站收录" rel="bookmark inlinks">利用google博客的ping服务接口API加快网站收录</a></li>
<li><a href="http://js8.in/875.html" title="javascript作用域和作用域链" rel="bookmark inlinks">javascript作用域和作用域链</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2011. |
<a href="http://js8.in/902.html#comments">8 comments</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/bug" rel="tag">bug</a>, <a href="http://js8.in/tag/ie6" rel="tag">IE6</a>, <a href="http://js8.in/tag/javascript" rel="tag">javascript</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F902.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F902.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F902.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6下javascript不能隐藏select标签的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&from=http%3A%2F%2Fjs8.in%2F902.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987937.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6下javascript不能隐藏select标签的bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/902.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>IE6中a标签location.href失效解决方法</title>
		<link>http://js8.in/706.html</link>
		<comments>http://js8.in/706.html#comments</comments>
		<pubDate>Wed, 20 Jul 2011 15:00:51 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[IE6]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=706</guid>
		<description><![CDATA[今天遇见IE6一个location.href的bug，具体情况是这样的，IE6下，在a标签中，将href写成javascript:;javascript:void(0);，并且给这个标签绑定onclick事件，点击后，执行location.href实现页面跳转，例如下面的代码：<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F706.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="最新版wBox 解决IE6 背景太小bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F506.html&from=http%3A%2F%2Fjs8.in%2F706.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977733.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">最新版wBox 解决IE6 背景太小bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F706.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6下javascript不能隐藏select标签的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&from=http%3A%2F%2Fjs8.in%2F706.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987937.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6下javascript不能隐藏select标签的bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>今天遇见IE6一个<strong>location.href</strong>的bug，具体情况是这样的，IE6下，在a标签中，将href写成<code>javascript:;</code><code>javascript:void(0);</code>，并且给这个标签绑定onclick事件，点击后，执行location.href实现页面跳转，例如下面的代码：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;javascitp:;&quot; onclick=&quot;toURL()&quot;&gt;点击跳转&lt;/a&gt;</pre></div></div>

<p>或者</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;javascitp:void(0);&quot; onclick=&quot;toURL()&quot;&gt;点击跳转&lt;/a&gt;</pre></div></div>

<p>toURL函数的代码如下所示：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> toURL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	location.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;http://js8.in&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>这样在非IE6浏览器下都可以使用，但是在IE6下就是跳转不了，而且不报错，在location.href之后的代码，例如（alert(1);）也是执行的。</p>
<h3>IE6下location.href失效解决的方法</h3>
<p>解决IE6中a标签中location.href失效的方式就是a标签中的href不用使用<code>javascript:;</code>或<code>javascript:void(0);</code>。具体原因还不清楚，不过我们可以使用href=&#8221;#&#8221;来代替。<br />
<span id="more-706"></span><br />
例如下面的代码在IE6中是正常的：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;###&quot; onclick=&quot;toURL()&quot;&gt;正常的跳转&lt;/a&gt;</pre></div></div>

<p>还有一种方式就是，在toURL函数里面将a标签的href通过setAttribute设置为“#”，然后再使用location.href跳转也是可以的。</p>
<p>另外可以通过获取DOM节点，然后绑定onclick事件的方式，也是可以解决上面的问题的，例如下面的代码：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066; font-weight: bold;">as</span> <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #009900;">&#41;</span><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;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>as.<span style="color: #660066;">length</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: #000066; font-weight: bold;">as</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">onclick</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>
          window.<span style="color: #660066;">location</span>.<span style="color: #660066;">href</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://js8.in&quot;</span><span style="color: #339933;">;</span>
         <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>写在最后</h3>
<p>IE6——前端的噩梦还在继续。<br />
对于IE6真的不想说什么了，本小站已经不在支持IE6了，希望IE6尽快的退出历史舞台。<br />
<embed src="http://www.tudou.com/v/8nmFnHVLFWs/v.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="480" height="400"></embed>
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/706.html" title="IE6中a标签location.href失效解决方法">http://js8.in/706.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/692.html" title="新浪微博应用：微博送大礼" rel="bookmark inlinks">新浪微博应用：微博送大礼</a></li>
<li><a href="http://js8.in/445.html" title="Google AdWords免费广告费用申请下来了" rel="bookmark inlinks">Google AdWords免费广告费用申请下来了</a></li>
<li><a href="http://js8.in/541.html" title="IE onchange事件触发bug？" rel="bookmark inlinks">IE onchange事件触发bug？</a></li>
<li><a href="http://js8.in/336.html" title="博客终于再次开通了" rel="bookmark inlinks">博客终于再次开通了</a></li>
<li><a href="http://js8.in/642.html" title="使用mysqldump、into outfile和load data进行数据库导入导出备份" rel="bookmark inlinks">使用mysqldump、into outfile和load data进行数据库导入导出备份</a></li>
<li><a href="http://js8.in/360.html" title="竟然真的申请到了谷歌AdWords500元广告费用" rel="bookmark inlinks">竟然真的申请到了谷歌AdWords500元广告费用</a></li>
<li><a href="http://js8.in/557.html" title="解决IE6背景图片不缓存的BUG" rel="bookmark inlinks">解决IE6背景图片不缓存的BUG</a></li>
<li><a href="http://js8.in/508.html" title="简单代码实现checkbox全选" rel="bookmark inlinks">简单代码实现checkbox全选</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2011. |
<a href="http://js8.in/706.html#comments">6 comments</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/bug" rel="tag">bug</a>, <a href="http://js8.in/tag/ie6" rel="tag">IE6</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F706.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="最新版wBox 解决IE6 背景太小bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F506.html&from=http%3A%2F%2Fjs8.in%2F706.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977733.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">最新版wBox 解决IE6 背景太小bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F706.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6下javascript不能隐藏select标签的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&from=http%3A%2F%2Fjs8.in%2F706.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987937.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6下javascript不能隐藏select标签的bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/706.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>使用windows7的virtual PC打造原装IE6、IE7、IE8测试环境</title>
		<link>http://js8.in/688.html</link>
		<comments>http://js8.in/688.html#comments</comments>
		<pubDate>Wed, 18 May 2011 12:38:49 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[windows7技巧]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[virtual PC]]></category>
		<category><![CDATA[windows7]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=688</guid>
		<description><![CDATA[公司使用的是windows7操作系统，自己之前一直使用IETester来测试页面在IE6~IE8下的兼容性，可是在测试js的时候还是会出现实际使用的还是windows7的IE8内核问题。<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F688.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F688.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6 select z-index无效，遮挡div的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F553.html&from=http%3A%2F%2Fjs8.in%2F688.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987560.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6 select z-index无效，遮挡div的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F688.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>公司使用的是windows7操作系统，自己之前一直使用IETester来测试页面在IE6~IE8下的兼容性，可是在测试js的时候还是会出现实际使用的还是windows7的IE8内核问题。<br />
所以自己想通过<strong>virtual PC</strong>来搭建个虚拟的测试环境，为什么选择virtual PC呢？<br />
1、windows 7系统自带，并且xp mode就可以直接安装上xp系统<br />
2、windows 7支持自动发布功能，即不启动虚拟机的情况也可以在xp下运行相应的程序，节省内存开销</p>
<h3>安装虚拟机</h3>
<p>第一步是安装xp MODE，这个网上很多教程，很简单我们就安装了带有IE6的xp系统了，并且可以把IE6发布到windows7上去运行<br />
第二步是创建第二个虚拟机，也就是带IE7的xp虚拟机，我先找了个sp2的xp安装上了（可以在设置里面添加ISO），可是不支持自动发布，当我查看帮助文件的时候发现原来只用sp3以上的系统才支持自动发布，于是先升级sp3,。<br />
升级sp3的时候悲剧了，因为一开始设置的虚拟硬盘大小是3G，导致sp3升级包升级的时候显示磁盘不足，试了很多扩展虚拟硬盘的方法都是不行，只有重新删除硬盘再次创建一个大点的硬盘，这次我创建的虚拟硬盘大小是5G，安装sp2，然后安装sp3，之后就是安装集成系统。<br />
一切就绪了，可是还是不支持自动发布功能，后来在帮助里面发现了原来sp3还是要安装一个补丁的，即（<a target="_blank" href="http://www.microsoft.com/downloads/zh-cn/details.aspx?FamilyID=e5433d88-685f-4036-b435-570ff53598cd&amp;displaylang=zh-cn" target="_blank">Windows® XP SP3 用于启用 RemoteApp™ 的更新</a> ）<br />
安装补丁之后终于可以了！<br />
下面是截图：</p>
<p><div id="attachment_687" class="wp-caption aligncenter" style="width: 310px"><a rel="attachment wp-att-687" href="http://js8.in/688.html/2011-05-18_101406"><img class="size-medium wp-image-687" title="使用windows7的virtual PC打造原装IE6、IE7、IE8环境" src="http://js8.in/wp-content/uploads/2011/05/2011-05-18_101406-300x191.png" alt="使用windows7的virtual PC打造原装IE6、IE7、IE8环境" width="300" height="191" /></a><p class="wp-caption-text">使用windows7的virtual PC打造原装IE6、IE7、IE8环境</p></div><br />
<span id="more-688"></span></p>
<h3>总结一下</h3>
<p>1、创建虚拟机方法：打开管理→工具栏上部有个“创建虚拟机”→设置放入ISO安装<br />
2、如果你有sp3的安装iso最好，我的是悲催的sp2，以后只好升级了<br />
3、推荐使用原版的安装方法，不要使用ghost之类的，原因太大，毕竟我们使用也就是用用IE7、IE6没有必要大材小用<br />
4、记得安装Windows® XP SP3 用于启用 RemoteApp™ 的更新<br />
5、记得启用集成功能，虚拟机顶部设置“安装集成”！<br />
6、自动发布使用方法，进入全部用户的文件夹（可以在开始菜单右键→浏览全部用户文件）把想要在win7下运行的软件快捷方式复制过去即可
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/688.html" title="使用windows7的virtual PC打造原装IE6、IE7、IE8测试环境">http://js8.in/688.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/346.html" title="Wordpress Follow5 插件开发日记—插件后台Ajax应用及jQuery的使用" rel="bookmark inlinks">Wordpress Follow5 插件开发日记—插件后台Ajax应用及jQuery的使用</a></li>
<li><a href="http://js8.in/240.html" title="是不是应该出售2fool.cn的域名" rel="bookmark inlinks">是不是应该出售2fool.cn的域名</a></li>
<li><a href="http://js8.in/395.html" title="Google2009年Logo大盘点——第二季" rel="bookmark inlinks">Google2009年Logo大盘点——第二季</a></li>
<li><a href="http://js8.in/711.html" title="host配置：设置电脑DNS解析文件host" rel="bookmark inlinks">host配置：设置电脑DNS解析文件host</a></li>
<li><a href="http://js8.in/570.html" title="十枚腾讯微博内测邀请的种子" rel="bookmark inlinks">十枚腾讯微博内测邀请的种子</a></li>
<li><a href="http://js8.in/764.html" title="nodejs教程：配置nodejs.exe的windows目录结构" rel="bookmark inlinks">nodejs教程：配置nodejs.exe的windows目录结构</a></li>
<li><a href="http://js8.in/623.html" title="IE event.stopPropagation()阻止冒泡事件" rel="bookmark inlinks">IE event.stopPropagation()阻止冒泡事件</a></li>
<li><a href="http://js8.in/941.html" title="PHP实现javascript的escape和unescape函数" rel="bookmark inlinks">PHP实现javascript的escape和unescape函数</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2011. |
<a href="http://js8.in/688.html#comments">No comment</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/ie6" rel="tag">IE6</a>, <a href="http://js8.in/tag/virtual-pc" rel="tag">virtual PC</a>, <a href="http://js8.in/tag/windows7" rel="tag">windows7</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F688.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F688.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6 select z-index无效，遮挡div的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F553.html&from=http%3A%2F%2Fjs8.in%2F688.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987560.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6 select z-index无效，遮挡div的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F688.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/688.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE6下javascript不能隐藏select标签的bug</title>
		<link>http://js8.in/686.html</link>
		<comments>http://js8.in/686.html#comments</comments>
		<pubDate>Sat, 14 May 2011 07:50:57 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web前端开发]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=686</guid>
		<description><![CDATA[昨天做了一个简单的项目，要求有三级联动的select菜单，可是伤不起的IE6下就出现了不能隐藏select的bug，之前我也介绍过IE6下select层高的问题，可以通过隐藏select或者使用iframe遮挡的方式来解决，今天的bug不同以前，大家如果在用js控制select显示隐藏的时候可能会经常遇到，调试一下午终于找到了解决的方案，特此记录一下<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F686.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="png在IE6下透明的几种方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F448.html&from=http%3A%2F%2Fjs8.in%2F686.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/8885105.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">png在IE6下透明的几种方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中javascript文件开启Gzip出现代码不执行情况" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F902.html&from=http%3A%2F%2Fjs8.in%2F686.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中javascript文件开启Gzip出现代码不执行情况</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F686.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>昨天做了一个简单的项目，要求有三级联动的select菜单，可是伤不起的IE6下就出现了<strong>不能隐藏select</strong>的bug，之前我也介绍过IE6下select层高的问题，可以通过隐藏select或者<a title="解决IE6 select z-index无效，遮挡div的bug" href="http://js8.in/553.html" target="_blank">使用iframe遮挡</a>的方式来解决，今天的bug不同以前，大家如果在用js控制select显示隐藏的时候可能会经常遇到，调试一下午终于找到了解决的方案，特此记录一下。</p>
<h3>IE6不能隐藏select重现代码</h3>
<p>建立两个关联的select，通过javascript控制第一个select 发生变化后，第二个select根据第一个value重新添加options，如果为空则隐藏第二个select（示例中判断除第一个之外都隐藏），则由第一个select的第三个value切换到第二个value则第二个select就不会隐藏。<br />
具体效果见下面的实例：</p>
<p class="demoview"><a target="_blank" href="//js8.in/mywork/ie6selectbug.html" target="_blank">IE6 select隐藏bug</a></p>
<h3>IE6下不能隐藏select标签解决方案</h3>
<ol>
<li>可以通过先设置select为显示，后设置为none的方式</li>
<li>通过给select添加class来控制显示</li>
</ol>
<p>具体方法，见示例代码源码注释的地方。
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/686.html" title="IE6下javascript不能隐藏select标签的bug">http://js8.in/686.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/44.html" title="没见过这么不要脸的！——校内网太不厚道，无耻之" rel="bookmark inlinks">没见过这么不要脸的！——校内网太不厚道，无耻之</a></li>
<li><a href="http://js8.in/664.html" title="iframe自适用高度代码" rel="bookmark inlinks">iframe自适用高度代码</a></li>
<li><a href="http://js8.in/818.html" title="chrome扩展应用开发教程之开发chrome应用基础" rel="bookmark inlinks">chrome扩展应用开发教程之开发chrome应用基础</a></li>
<li><a href="http://js8.in/330.html" title="光良,第一次—珍喜欢" rel="bookmark inlinks">光良,第一次—珍喜欢</a></li>
<li><a href="http://js8.in/526.html" title="Ubuntu安装Samba实现跟windows文件共享" rel="bookmark inlinks">Ubuntu安装Samba实现跟windows文件共享</a></li>
<li><a href="http://js8.in/507.html" title="25大实用的jQuery技巧和解决方案" rel="bookmark inlinks">25大实用的jQuery技巧和解决方案</a></li>
<li><a href="http://js8.in/67.html" title="校内人人网忽悠用户-陈一舟牛啊~" rel="bookmark inlinks">校内人人网忽悠用户-陈一舟牛啊~</a></li>
<li><a href="http://js8.in/17.html" title="windows Xp和office盗版软件避免十月20号之后出现黑屏方法" rel="bookmark inlinks">windows Xp和office盗版软件避免十月20号之后出现黑屏方法</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2011. |
<a href="http://js8.in/686.html#comments">4 comments</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/css" rel="tag">css</a>, <a href="http://js8.in/tag/ie6" rel="tag">IE6</a>, <a href="http://js8.in/tag/javascript" rel="tag">javascript</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F686.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="png在IE6下透明的几种方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F448.html&from=http%3A%2F%2Fjs8.in%2F686.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/8885105.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">png在IE6下透明的几种方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中javascript文件开启Gzip出现代码不执行情况" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F902.html&from=http%3A%2F%2Fjs8.in%2F686.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中javascript文件开启Gzip出现代码不执行情况</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F686.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/686.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>解决IE6不支持max-height的bug</title>
		<link>http://js8.in/606.html</link>
		<comments>http://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为最大高度，<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F606.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="最新版wBox 解决IE6 背景太小bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F506.html&from=http%3A%2F%2Fjs8.in%2F606.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977733.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">最新版wBox 解决IE6 背景太小bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6背景图片不缓存的BUG" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F557.html&from=http%3A%2F%2Fjs8.in%2F606.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://hi.csdn.net/attachment/201104/11/0_1302522572HMK6.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6背景图片不缓存的BUG</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F606.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></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;">&gt;</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://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;">&gt;</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> <span style="color: #00AA00;">&gt;</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">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/606.html" title="解决IE6不支持max-height的bug">http://js8.in/606.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/706.html" title="IE6中a标签location.href失效解决方法" rel="bookmark inlinks">IE6中a标签location.href失效解决方法</a></li>
<li><a href="http://js8.in/677.html" title="自己写的一个轻量级javascript框架的设计模式" rel="bookmark inlinks">自己写的一个轻量级javascript框架的设计模式</a></li>
<li><a href="http://js8.in/667.html" title="修改获取验证码图片到本地的PHP程序" rel="bookmark inlinks">修改获取验证码图片到本地的PHP程序</a></li>
<li><a href="http://js8.in/490.html" title="使用CSS设置文字反选的背景颜色" rel="bookmark inlinks">使用CSS设置文字反选的背景颜色</a></li>
<li><a href="http://js8.in/542.html" title="通过修改注册表去掉windows7的快捷方式小箭头" rel="bookmark inlinks">通过修改注册表去掉windows7的快捷方式小箭头</a></li>
<li><a href="http://js8.in/40.html" title="影视剧中就那点剧情！" rel="bookmark inlinks">影视剧中就那点剧情！</a></li>
<li><a href="http://js8.in/4.html" title="哎~都挺穷的！" rel="bookmark inlinks">哎~都挺穷的！</a></li>
<li><a href="http://js8.in/496.html" title="WordPress博客的 SEO 技巧" rel="bookmark inlinks">WordPress博客的 SEO 技巧</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2010. |
<a href="http://js8.in/606.html#comments">No comment</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/bug" rel="tag">bug</a>, <a href="http://js8.in/tag/ie6" rel="tag">IE6</a>, <a href="http://js8.in/tag/jquery" rel="tag">jquery</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F606.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="最新版wBox 解决IE6 背景太小bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F506.html&from=http%3A%2F%2Fjs8.in%2F606.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977733.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">最新版wBox 解决IE6 背景太小bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6背景图片不缓存的BUG" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F557.html&from=http%3A%2F%2Fjs8.in%2F606.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://hi.csdn.net/attachment/201104/11/0_1302522572HMK6.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6背景图片不缓存的BUG</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F606.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/606.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决IE6背景图片不缓存的BUG</title>
		<link>http://js8.in/557.html</link>
		<comments>http://js8.in/557.html#comments</comments>
		<pubDate>Mon, 21 Jun 2010 13:34:13 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[前端开发]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=557</guid>
		<description><![CDATA[本文提出IE6在背景图片缓存上的一个bug，并且提出两种解决方案。IE6在背景图片缓存上有一个bug：它会每次都从服务器端读取背景图片。例如我们使用a:hover更换背景图片，在IE6下会出现每次鼠标滑过则重新向服务器请求图片，如果服务器反应较慢，那么hover效果就会出现短暂的空白<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F557.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F557.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6 select z-index无效，遮挡div的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F553.html&from=http%3A%2F%2Fjs8.in%2F557.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987560.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6 select z-index无效，遮挡div的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="最新版wBox 解决IE6 背景太小bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F506.html&from=http%3A%2F%2Fjs8.in%2F557.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977733.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">最新版wBox 解决IE6 背景太小bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p><strong>IE6</strong>在背景图片缓存上有一个<strong>bug</strong>：它会每次都从服务器端读取背景图片。例如我们使用a:hover更换背景图片，在IE6下会出现每次鼠标滑过则重新向服务器请求图片，如果服务器反应较慢，那么hover效果就会出现短暂的空白，令人极度不爽。虽然可以通过<strong>CSS sprites</strong>的方式解决问题的，但效果差强人意。</p>
<p>示例：<br />
<code style="font: normal normal normal 1.1em/normal 'Courier New', Courier, Fixed;">a{ background:url(normal.gif); } a:hover { background:url(hover.gif); }</code><br />
如果为超级链接定义上述的css样式以实现鼠标悬浮时的动态效果，在firefox下是没有什么问题的，第一次加载之后，浏览器都会从缓存读取背景图片.</p>
<h3>解决方法</h3>
<p>具体的<strong>解决方法</strong>就是在页面中加入一段简单的javascript脚本，告诉IE6：本地有背景图片的话就不要麻烦服务器了。 <code style="font: normal normal normal 1.1em/normal 'Courier New', Courier, Fixed;">document.execCommand("BackgroundImageCache",false,true);</code></p>
<p>关于这段脚本的放置方式有两种：</p>
<p><span id="more-557"></span></p>
<p style="padding-left: 30px; ">1.使用CSS，在CSS中加入如下代码</p>
<blockquote style="padding-left: 30px; ">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">html <span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span><span style="color: #00AA00;">&#123;</span> filter<span style="color: #00AA00;">:</span> expression<span style="color: #00AA00;">&#40;</span>document.execCommand<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">&quot;BackgroundImageCache&quot;</span><span style="color: #00AA00;">,</span> false<span style="color: #00AA00;">,</span> true<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

</blockquote>
<p style="padding-left: 30px; ">2.使用JS：</p>
<blockquote style="padding-left: 30px; ">
<pre style="padding-left: 30px; " lang="javascript">document.execCommand("BackgroundImageCache",false,true);</pre>
</blockquote>
<p>另外查了一下关于这个<strong>document.execCommand</strong> 的一些其他用法</p>
<blockquote ><p>2D-Position 允许通过拖曳移动绝对定位的对象。<br />
AbsolutePosition 设定元素的 position 属性为“absolute”(绝对)。<br />
BackColor 设置或获取当前选中区的背景颜色。<br />
BlockDirLTR 目前尚未支持。<br />
BlockDirRTL 目前尚未支持。<br />
Bold 切换当前选中区的粗体显示与否。<br />
BrowseMode 目前尚未支持。<br />
Copy 将当前选中区复制到剪贴板。<br />
CreateBookmark 创建一个书签锚或获取当前选中区或插入点的书签锚的名称。<br />
CreateLink 在当前选中区上插入超级链接，或显示一个对话框允许用户指定要为当前选中区插入的超级链接的 URL。<br />
Cut 将当前选中区复制到剪贴板并删除之。<br />
Delete 删除当前选中区。<br />
DirLTR 目前尚未支持。<br />
DirRTL 目前尚未支持。<br />
EditMode 目前尚未支持。<br />
FontName 设置或获取当前选中区的字体。<br />
FontSize 设置或获取当前选中区的字体大小。<br />
ForeColor 设置或获取当前选中区的前景(文本)颜色。<br />
FormatBlock 设置当前块格式化标签。<br />
Indent 增加选中文本的缩进。<br />
InlineDirLTR 目前尚未支持。<br />
InlineDirRTL 目前尚未支持。<br />
InsertButton 用按钮控件覆盖当前选中区。<br />
InsertFieldset 用方框覆盖当前选中区。<br />
InsertHorizontalRule 用水平线覆盖当前选中区。<br />
InsertIFrame 用内嵌框架覆盖当前选中区。<br />
InsertImage 用图像覆盖当前选中区。<br />
InsertInputButton 用按钮控件覆盖当前选中区。<br />
InsertInputCheckbox 用复选框控件覆盖当前选中区。<br />
InsertInputFileUpload 用文件上载控件覆盖当前选中区。<br />
InsertInputHidden 插入隐藏控件覆盖当前选中区。<br />
InsertInputImage 用图像控件覆盖当前选中区。<br />
InsertInputPassword 用密码控件覆盖当前选中区。<br />
InsertInputRadio 用单选钮控件覆盖当前选中区。<br />
InsertInputReset 用重置控件覆盖当前选中区。<br />
InsertInputSubmit 用提交控件覆盖当前选中区。<br />
InsertInputText 用文本控件覆盖当前选中区。<br />
InsertMarquee 用空字幕覆盖当前选中区。<br />
InsertOrderedList 切换当前选中区是编号列表还是常规格式化块。<br />
InsertParagraph 用换行覆盖当前选中区。<br />
InsertSelectDropdown 用下拉框控件覆盖当前选中区。<br />
InsertSelectListbox 用列表框控件覆盖当前选中区。<br />
InsertTextArea 用多行文本输入控件覆盖当前选中区。<br />
InsertUnorderedList 切换当前选中区是项目符号列表还是常规格式化块。<br />
Italic 切换当前选中区斜体显示与否。<br />
JustifyCenter 将当前选中区在所在格式化块置中。<br />
JustifyFull 目前尚未支持。<br />
JustifyLeft 将当前选中区所在格式化块左对齐。<br />
JustifyNone 目前尚未支持。<br />
JustifyRight 将当前选中区所在格式化块右对齐。<br />
LiveResize 迫使 MSHTML 编辑器在缩放或移动过程中持续更新元素外观，而不是只在移动或缩放完成后更新。<br />
MultipleSelection 允许当用户按住 Shift 或 Ctrl 键时一次选中多于一个站点可选元素。<br />
Open 打开。<br />
Outdent 减少选中区所在格式化块的缩进。<br />
OverWrite 切换文本状态的插入和覆盖。<br />
Paste 用剪贴板内容覆盖当前选中区。<br />
PlayImage 目前尚未支持。<br />
Print 打开打印对话框以便用户可以打印当前页。<br />
Redo 重做。<br />
Refresh 刷新当前文档。<br />
RemoveFormat 从当前选中区中删除格式化标签。<br />
RemoveParaFormat 目前尚未支持。<br />
SaveAs 将当前 Web 页面保存为文件。<br />
SelectAll 选中整个文档。<br />
SizeToControl 目前尚未支持。<br />
SizeToControlHeight 目前尚未支持。<br />
SizeToControlWidth 目前尚未支持。<br />
Stop 停止。<br />
StopImage 目前尚未支持。<br />
StrikeThrough 目前尚未支持。<br />
Subscript 目前尚未支持。<br />
Superscript 目前尚未支持。<br />
UnBookmark 从当前选中区中删除全部书签。<br />
Underline 切换当前选中区的下划线显示与否。<br />
Undo 撤消。<br />
Unlink 从当前选中区中删除全部超级链接。<br />
Unselect 清除当前选中区的选中状态。</p></blockquote>
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/557.html" title="解决IE6背景图片不缓存的BUG">http://js8.in/557.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/492.html" title="十大Google Buzz的使用技巧" rel="bookmark inlinks">十大Google Buzz的使用技巧</a></li>
<li><a href="http://js8.in/689.html" title="NodeList集合跟Array数组的区别" rel="bookmark inlinks">NodeList集合跟Array数组的区别</a></li>
<li><a href="http://js8.in/591.html" title="切换订阅地址到feedsky" rel="bookmark inlinks">切换订阅地址到feedsky</a></li>
<li><a href="http://js8.in/450.html" title="jQuery1.4正式版新功能及性能测试" rel="bookmark inlinks">jQuery1.4正式版新功能及性能测试</a></li>
<li><a href="http://js8.in/330.html" title="光良,第一次—珍喜欢" rel="bookmark inlinks">光良,第一次—珍喜欢</a></li>
<li><a href="http://js8.in/23.html" title="园艺学院网站内测！开始，欢迎访问" rel="bookmark inlinks">园艺学院网站内测！开始，欢迎访问</a></li>
<li><a href="http://js8.in/532.html" title="Javascript中模拟PHP的base64_decode和base64_encode函数" rel="bookmark inlinks">Javascript中模拟PHP的base64_decode和base64_encode函数</a></li>
<li><a href="http://js8.in/598.html" title="Ubuntu安装NVidia驱动" rel="bookmark inlinks">Ubuntu安装NVidia驱动</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2010. |
<a href="http://js8.in/557.html#comments">No comment</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/ie6" rel="tag">IE6</a>, <a href="http://js8.in/tag/%e5%89%8d%e7%ab%af%e5%bc%80%e5%8f%91" rel="tag">前端开发</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F557.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F557.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="解决IE6 select z-index无效，遮挡div的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F553.html&from=http%3A%2F%2Fjs8.in%2F557.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987560.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6 select z-index无效，遮挡div的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="最新版wBox 解决IE6 背景太小bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F506.html&from=http%3A%2F%2Fjs8.in%2F557.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977733.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">最新版wBox 解决IE6 背景太小bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/557.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决IE6 select z-index无效，遮挡div的bug</title>
		<link>http://js8.in/553.html</link>
		<comments>http://js8.in/553.html#comments</comments>
		<pubDate>Fri, 18 Jun 2010 01:33:03 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[IE6]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=553</guid>
		<description><![CDATA[在最近的一个项目中，遇到了IE6 select遮挡div的bug，为了解决这个bug我查了很多资料，试图找到一个最最有效的方法，很多人是通过iframe的方法来解决，其实我查了国外的很多资料也是通过iframe的方法来解决的。今天我说说iframe解决的一般方法，已经使用jQuery插件bgiframe解决IE6 select z-index无效，遮挡div的bug。<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F553.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="png在IE6下透明的几种方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F448.html&from=http%3A%2F%2Fjs8.in%2F553.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/8885105.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">png在IE6下透明的几种方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F553.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="最新版wBox 解决IE6 背景太小bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F506.html&from=http%3A%2F%2Fjs8.in%2F553.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977733.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">最新版wBox 解决IE6 背景太小bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>在最近的一个项目中，遇到了<strong>IE6 select遮挡div</strong>的bug，为了解决这个bug我查了很多资料，试图找到一个最最有效的方法，很多人是通过<strong>iframe</strong>的方法来解决，其实我查了国外的很多资料也是通过iframe的方法来解决的。今天我说说iframe解决的一般方法，已经使用<strong>jQuery</strong>插件<strong>bgifram</strong>e解决IE6 select z-index无效，<strong>遮挡div</strong>的bug。</p>
<h3>解决方法之一：Iframe包裹select元素</h3>
<p>使用iframe包住select，这样iframe有z-index，只要在div上设置的z-index比iframe的高即可~这种方法有一定的局限性，不可能每个select都要加个iframe吧？所以<strong>不推荐</strong>！代码如下：</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;iframe style=&quot;z-index:1;position: absolute; &quot;&gt;&lt;!-- 用iframe 解决此bug --&gt;     
            &lt;select name=&quot;country&quot;&gt;                    
                 &lt;option value=&quot;1&quot;&gt;china&lt;/option&gt;     
                &lt;option value=&quot;2&quot;&gt;japanese&lt;/option&gt;     
                &lt;option value=&quot;1&quot;&gt;U.S.A&lt;/option&gt;     
             &lt;/select&gt;     
&lt;/iframe&gt;</pre></div></div>

</blockquote>
<h3>解决方法之二：以Iframe作为div的子元素，覆盖select元素</h3>
<p>建立一个跟div同宽同高的iframe，并且z-index比div要低。这种方法<strong>推荐</strong>使用：<br />
<span id="more-553"></span></p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;style&gt;.T_iframe   
{   
    position: absolute;/*绝对定位保证iframe不会占用流布局空间*/   
    width: 100%;    /*100%保证可以覆盖整个div*/   
    height: 100%;   
    z-index:-1; /*-1保证iframe显示在div下方*/   
}   
.T_div   
{   
    position: absolute;   
    left:100px;   
    top:50px;   
    width: 300px;   
    height: 200px;   
    background : blue;     
    z-index:100;   
}   &lt;/style&gt;
&lt;div class=&quot;T_div&quot;&gt;  
     &lt;span&gt;这里可以包含其他dom元素&lt;/span&gt;  
     &lt;iframe class=&quot;T_iframe&quot;&gt;&lt;/iframe&gt;  
&lt;/div&gt;</pre></div></div>

</blockquote>
<h3>解决方法之三：使用jQuery的bgiframe插件</h3>
<p>如果你的项目引用了jQuery，那么我推荐使用<strong>bgiframe</strong>插件来解决select的遮挡div问题，原理很简单，就是建立一个同高同宽的iframe插入到div中去~bgiframe下载地址：<a target="_blank" href="http://github.com/brandonaaron/bgiframe" target="_blank">http://github.com/brandonaaron/bgiframe</a>，使用方法：</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;">'.fix-z-index'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bgiframe</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>参数说明：</p>
<blockquote><p>
<strong>top</strong>：设置top位置，默认为auto<br />
<strong>left</strong>：设置left位置，默认为auto<br />
<strong>width</strong>：设置iframe宽度，默认为auto<br />
<strong>height</strong>：设置iframe高度，默认为auto<br />
<strong>opacity</strong>：设置是否透明，默认为true<br />
<strong>src</strong>：设置iframe的src，默认为javascript:false
</p></blockquote>
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/553.html" title="解决IE6 select z-index无效，遮挡div的bug">http://js8.in/553.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/497.html" title="韩峰其实是个好干部" rel="bookmark inlinks">韩峰其实是个好干部</a></li>
<li><a href="http://js8.in/349.html" title="发布一个Follow5的API PHP类" rel="bookmark inlinks">发布一个Follow5的API PHP类</a></li>
<li><a href="http://js8.in/25.html" title="Adobe紧急发布flash Clickjacking漏洞暂时的解决方案" rel="bookmark inlinks">Adobe紧急发布flash Clickjacking漏洞暂时的解决方案</a></li>
<li><a href="http://js8.in/552.html" title="2010年世界杯比赛时间表-北京时间" rel="bookmark inlinks">2010年世界杯比赛时间表-北京时间</a></li>
<li><a href="http://js8.in/519.html" title="windows下安装基于Apache的SVN服务器" rel="bookmark inlinks">windows下安装基于Apache的SVN服务器</a></li>
<li><a href="http://js8.in/670.html" title="提高网站访问速度的十个技巧" rel="bookmark inlinks">提高网站访问速度的十个技巧</a></li>
<li><a href="http://js8.in/573.html" title="通过On Top Replica 置顶任意窗口的任意部分" rel="bookmark inlinks">通过On Top Replica 置顶任意窗口的任意部分</a></li>
<li><a href="http://js8.in/21.html" title="网站首页做完了~i.2fool.cn" rel="bookmark inlinks">网站首页做完了~i.2fool.cn</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2010. |
<a href="http://js8.in/553.html#comments">4 comments</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/ie6" rel="tag">IE6</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F553.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="png在IE6下透明的几种方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F448.html&from=http%3A%2F%2Fjs8.in%2F553.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/8885105.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">png在IE6下透明的几种方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F553.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="最新版wBox 解决IE6 背景太小bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F506.html&from=http%3A%2F%2Fjs8.in%2F553.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10977733.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">最新版wBox 解决IE6 背景太小bug</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/553.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>最新版wBox 解决IE6 背景太小bug</title>
		<link>http://js8.in/506.html</link>
		<comments>http://js8.in/506.html#comments</comments>
		<pubDate>Thu, 11 Mar 2010 09:05:46 +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>
		<category><![CDATA[wBox]]></category>

		<guid isPermaLink="false">http://www.js8.in/506.html</guid>
		<description><![CDATA[今天看了一下cssrain的评论，都提出来了再IE6下wBox背景显示不全，不能完全覆盖页面的问题，在wBox开发中，IE6下的背景最初我是通过CSS hack来解决的<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F506.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery插件wBox准备更新" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F531.html&from=http%3A%2F%2Fjs8.in%2F506.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/18/11026389.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery插件wBox准备更新</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery弹出框wBox的一个使用实例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F585.html&from=http%3A%2F%2Fjs8.in%2F506.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10979343.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery弹出框wBox的一个使用实例</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F506.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>今天看了一下cssrain的评论，都提出来了再<strong>IE6</strong>下wBox背景显示不全，不能完全覆盖页面的问题，在<strong>wBox</strong>开发中，IE6下的背景最初我是通过CSS hack来解决的，代码如下：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">*</span> html <span style="color: #cc00cc;">#wBox_overlay</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #808080; font-style: italic;">/* ie6 hack */</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> expression<span style="color: #00AA00;">&#40;</span>document<span style="color: #6666ff;">.body</span><span style="color: #6666ff;">.scrollHeight</span> <span style="color: #00AA00;">&gt;</span> document<span style="color: #6666ff;">.body</span><span style="color: #6666ff;">.offsetHeight</span> ? document<span style="color: #6666ff;">.body</span><span style="color: #6666ff;">.scrollHeight</span> <span style="color: #00AA00;">:</span> document<span style="color: #6666ff;">.body</span><span style="color: #6666ff;">.offsetHeight</span> <span style="color: #00AA00;">+</span> <span style="color: #ff0000;">'px'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>但是这就造成了一个bug：当IE6下，页面高度不够的时候，就会出现背景不能完全覆盖整个页面的bug。<br />
下午的时候，我及时的修改了这个bug，通过计算页面高宽以及window的高宽，取其最大值作为背景层的高宽，这样就解决了wBox在IE6 下背景显示不全的bug啦~<br />
最新的wBox下载地址：<a target="_blank" href="http://code.google.com/p/follow5api/downloads/list" target="_blank">http://code.google.com/p/follow5api/downloads/list</a>
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/506.html" title="最新版wBox 解决IE6 背景太小bug">http://js8.in/506.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/356.html" title="发现Chrome下提交表单的一个bug" rel="bookmark inlinks">发现Chrome下提交表单的一个bug</a></li>
<li><a href="http://js8.in/380.html" title="IE6 PNG图片不透明问题的解决方法" rel="bookmark inlinks">IE6 PNG图片不透明问题的解决方法</a></li>
<li><a href="http://js8.in/568.html" title="再来几个腾讯微博的邀请种子" rel="bookmark inlinks">再来几个腾讯微博的邀请种子</a></li>
<li><a href="http://js8.in/491.html" title="雷：蓝翔技校黑谷歌！" rel="bookmark inlinks">雷：蓝翔技校黑谷歌！</a></li>
<li><a href="http://js8.in/509.html" title="php获取来访者IP信息" rel="bookmark inlinks">php获取来访者IP信息</a></li>
<li><a href="http://js8.in/566.html" title="利用GControl和GLayer对象在地图上显示panoramio图片" rel="bookmark inlinks">利用GControl和GLayer对象在地图上显示panoramio图片</a></li>
<li><a href="http://js8.in/17.html" title="windows Xp和office盗版软件避免十月20号之后出现黑屏方法" rel="bookmark inlinks">windows Xp和office盗版软件避免十月20号之后出现黑屏方法</a></li>
<li><a href="http://js8.in/6.html" title="经典QQ签名" rel="bookmark inlinks">经典QQ签名</a></li>
</ul>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2010. |
<a href="http://js8.in/506.html#comments">4 comments</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/bug" rel="tag">bug</a>, <a href="http://js8.in/tag/ie6" rel="tag">IE6</a>, <a href="http://js8.in/tag/jquery" rel="tag">jquery</a>, <a href="http://js8.in/tag/wbox" rel="tag">wBox</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="解决IE6不支持max-height的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F606.html&from=http%3A%2F%2Fjs8.in%2F506.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10978851.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">解决IE6不支持max-height的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery插件wBox准备更新" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F531.html&from=http%3A%2F%2Fjs8.in%2F506.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/18/11026389.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery插件wBox准备更新</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery弹出框wBox的一个使用实例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F585.html&from=http%3A%2F%2Fjs8.in%2F506.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10979343.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery弹出框wBox的一个使用实例</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签location.href失效解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&from=http%3A%2F%2Fjs8.in%2F506.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/21/18318778.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签location.href失效解决方法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/506.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>png在IE6下透明的几种方法</title>
		<link>http://js8.in/448.html</link>
		<comments>http://js8.in/448.html#comments</comments>
		<pubDate>Fri, 15 Jan 2010 02:47:44 +0000</pubDate>
		<dc:creator>三水清</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=448</guid>
		<description><![CDATA[png透明针对IE6一直是件挺麻烦的事情，使用的方法也是各有不同，大多的原理是用IE的滤镜来解决的。本文通过css方法、js方法、htc三种方法来实现IE6下png透明，其中断桥残雪推荐使用htc方法<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6下javascript不能隐藏select标签的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&from=http%3A%2F%2Fjs8.in%2F448.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987937.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6下javascript不能隐藏select标签的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F448.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中javascript文件开启Gzip出现代码不执行情况" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F902.html&from=http%3A%2F%2Fjs8.in%2F448.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中javascript文件开启Gzip出现代码不执行情况</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6 PNG图片不透明问题的解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F380.html&from=http%3A%2F%2Fjs8.in%2F448.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/01/2770440.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6 PNG图片不透明问题的解决方法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>断桥残雪在《<a href="http://js8.in/380.html" target="_blank" title="IE6 PNG图片不透明问题的解决方法">IE6 PNG图片不透明问题的解决方法</a>》中提到了使用js来解决IE6下PNG图片不透明的问题，今天我总结一下png在IE6下透明的方法：<strong>css方法</strong>、<strong>js方法</strong>、<strong>htc方法</strong>。</p>
<p>png透明针对IE6一直是件挺麻烦的事情，使用的方法也是各有不同，大多的原理是用IE的滤镜来解决的。</p>
<blockquote><p>语法：<br />
filter : progid:DXImageTransform.Microsoft.AlphaImageLoader ( enabled=bEnabled , sizingMethod=sSize , src=sURL )</p>
<p style="text-indent:0">enabled : 可选项。布尔值(Boolean)。设置或检索滤镜是否激活。true | false true : 默认值。滤镜激活。<br />
false : 滤镜被禁止。<br />
sizingMethod : 可选项。字符串(String)。设置或检索滤镜作用的对象的图片在对象容器边界内的显示方式。 crop : 剪切图片以适应对象尺寸。<br />
image : 默认值。增大或减小对象的尺寸边界以适应图片的尺寸。scale : 缩放图片以适应对象的尺寸边界。<br />
src : 必选项。字符串(String)。使用绝对或相对 url 地址指定背景图像。假如忽略此参数，滤镜将不会作用。</p>
</blockquote>
<p>现在一般在使用的方法有以下几种：<br />
<span id="more-448"></span></p>
<h3>1、css方法</h3>
<blockquote><p>
<strong>css</strong>：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.pngs</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">90px</span><span style="color: #00AA00;">;</span>width<span style="color: #00AA00;">:</span> <span style="color: #933;">90px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">icon_home.png</span><span style="color: #00AA00;">&#41;</span>!important<span style="color: #00AA00;">;</span>  <span style="color: #808080; font-style: italic;">/* FF IE7 */</span>
<span style="color: #000000; font-weight: bold;">background-repeat</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span> _filter<span style="color: #00AA00;">:</span> progid<span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span>.AlphaImageLoader<span style="color: #00AA00;">&#40;</span>src<span style="color: #00AA00;">=</span>’icon_home.png’<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>  <span style="color: #808080; font-style: italic;">/* IE6 */</span>
_ <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE6 */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>xhtml</strong>：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=”pngs”&gt;&lt;/div&gt;</pre></div></div>

</blockquote>
<p>这种方法的优点就是使用简单方便，但是不能作为背景，且只能用作单个png图片的使用。如果要作为背景，需要新增加一个div层，并设置其position:relative;</p>
<blockquote><p>
<strong>css</strong>：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.png</span> div<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>xhml</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=’png’&gt;
&lt;div&gt;
CSS 背景PNG透明 及 链接失效问题解决
&lt;/div&gt;
&lt;/div&gt;</pre></div></div>

</blockquote>
<p>这种方法可以使用在那些png图片不多，且不需要repeat的情况下。</p>
<h3>2、js方法</h3>
<pre lang=”javascript”>
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 &#038; 6.
{
    var arVersion = navigator.appVersion.split(“MSIE”)
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) &#038;&#038; (document.body.filters))
    {
       for(var j=0; j<document.images.length; j++)
       {
          var img = document.images[j]
          var imgName = img.src.toUpperCase()
          if (imgName.substring(imgName.length-3, imgName.length) == “PNG”)
          {
             var imgID = (img.id) ? “id=’” + img.id + “‘ ” : “”
             var imgClass = (img.className) ? “class=’” + img.className + “‘ ” : “”
             var imgTitle = (img.title) ? “title=’” + img.title + “‘ ” : “title=’” + img.alt + “‘ ”
             var imgStyle = “display:inline-block;” + img.style.cssText
             if (img.align == “left”) imgStyle = “float:left;” + imgStyle
             if (img.align == “right”) imgStyle = “float:right;” + imgStyle
             if (img.parentElement.href) imgStyle = “cursor:hand;” + imgStyle
             var strNewHTML = “<span ” + imgID + imgClass + imgTitle
             + ” style=\”" + “width:” + img.width + “px; height:” + img.height + “px;” + imgStyle + “;”
             + “filter:progid:DXImageTransform.Microsoft.AlphaImageLoader”
             + “(src=\’” + img.src + “\’, sizingMethod=’scale’);\”></span>”
             img.outerHTML = strNewHTML
             j = j-1
          }
       }
    }
}
window.attachEvent(“onload”, correctPNG);
</pre>
<p>这种js先判断是否IE，然后判断ie版本，版本在6.0下则判定函数，给png的图片添加滤镜。<br />
使用起来的确方便，无论多少图片都可以解决，但是依然无法repeat。</p>
<h3>3、htc方法</h3>
<p>htc相当于完全通过插件的方法修复的IE6的bug，功能强大，支持repeat，背景等功能，使用起来也很方便。<br />
使用一个<strong>iepngfix.htc</strong> 文件，和一个透明的gif文件。</p>
<p>使用方法：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!–[if lte IE 6]&gt;
&lt;style&gt;.png{behavior:url(“iepngfix.htc”);}&lt;/style&gt;  //在这里可以加入其他用到png图片的id或者class
&lt;script type=”text/javascript” src=”iepngfix_tilebg.js”&gt;&lt;/script&gt;
&lt;![endif]–&gt;</pre></div></div>

<p>ps：如果需要repeat背景，往往需要设置这个div 宽度为100%。</p>
<p>关于<strong>iepngfix.htc</strong>的详细用法以及<a target="_blank" href="http://www.twinhelix.com/css/iepngfix/demo/" target='_blank'>Demo</a>，请<a target="_blank" href="http://www.twinhelix.com/css/iepngfix/demo/" target='_blank'>狂点此处</a></p>
<h3>总结</h3>
<p>总结这几种方法，第三种方法（<strong>htc方法</strong>）是最简单实用，且容易推广的方法，建议可以做个公共的地址，有产品需要，只需要应用这个公共地址就行了。
<div class="copyright">
<strong>声明：</strong>文章未声明为原创文章，本文链接 <a href="http://js8.in/448.html" title="png在IE6下透明的几种方法">http://js8.in/448.html</a>. 转载请注明转自<a href="http://js8.in" title="前端开发博客"> JS8.IN ™</a></span></span></div>
<h3 class="box-title">随机文章</h3>
<ul class="box_random">
<li><a href="http://js8.in/643.html" title="CSS3 Media Queries使用方法详解" rel="bookmark inlinks">CSS3 Media Queries使用方法详解</a></li>
<li><a href="http://js8.in/809.html" title="javascript嵌套函数的效率问题" rel="bookmark inlinks">javascript嵌套函数的效率问题</a></li>
<li><a href="http://js8.in/350.html" title="javascript高效简洁代码的编写及优化技巧" rel="bookmark inlinks">javascript高效简洁代码的编写及优化技巧</a></li>
<li><a href="http://js8.in/818.html" title="chrome扩展应用开发教程之开发chrome应用基础" rel="bookmark inlinks">chrome扩展应用开发教程之开发chrome应用基础</a></li>
<li><a href="http://js8.in/559.html" title="实时公布腾讯微博邀请种子" rel="bookmark inlinks">实时公布腾讯微博邀请种子</a></li>
<li><a href="http://js8.in/41.html" title="007系列我看要末路啦~" rel="bookmark inlinks">007系列我看要末路啦~</a></li>
<li><a href="http://js8.in/379.html" title="cURL常用的几个PHP函数" rel="bookmark inlinks">cURL常用的几个PHP函数</a></li>
<li><a href="http://js8.in/464.html" title="使用hash来实现Ajax前进后退" rel="bookmark inlinks">使用hash来实现Ajax前进后退</a></li>
</ul>
<p style="margin:0;padding:0;height:1px;overflow:hidden;">
    <script type="text/javascript"><!--
        var wumiiSitePrefix = "http://js8.in";
        var wumiiEnableCustomPos = false;
        var wumiiParams = "&#038;num=4&#038;mode=3&#038;displayInFeed=1&#038;version=1.0.5.5&#038;pf=WordPress2.8.6";
    //--></script></p>
<hr />
<p><small>© 三水清 for <a href="http://js8.in">三水清</a>, 2010. |
<a href="http://js8.in/448.html#comments">2 comments</a> |在微博关注我：<a href="//weibo.com/sanshuiqing" target="_blank" title="关注断桥残雪的新浪微博">@清-三水清</a>
<br/>收藏到：
<a rel="nofollow" href="http://share.renren.com/share/buttonshare.do?link=%posturl%&title=%posttitle%" title="收藏本文到人人网" target="_blank">人人网</a> | <a rel="nofollow" href="http://www.douban.com/recommend/?url=%posturl%&title=%posttitle%" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&rurl=%posturl%" title="收藏本文到开心网" target="_blank">开心网</a> | <a rel="nofollow" href="http://shuqian.qq.com/post?title=%posttitle%&%20uri=%posturl%" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a rel="nofollow" href="http://v.t.sina.com.cn/share/share.php?url=%posturl%&title=%posttitle%" title="收藏本文到新浪微博" target="_blank">新浪微博</a> | <a rel="nofollow" href="http://v.t.qq.com/share/share.php?title=%posttitle%&url=%posturl%&site=http://www.kaixin100.info" title="收藏本文到腾讯微博" target="_blank">腾讯微博</a>
<br/>
Post tags: <a href="http://js8.in/tag/css" rel="tag">css</a>, <a href="http://js8.in/tag/ie6" rel="tag">IE6</a>, <a href="http://js8.in/tag/javascript" rel="tag">javascript</a><br/>
</small></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜你喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IE6下javascript不能隐藏select标签的bug" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&from=http%3A%2F%2Fjs8.in%2F448.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/17/10987937.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6下javascript不能隐藏select标签的bug</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中a标签触发图片和ajax请求被abort" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&from=http%3A%2F%2Fjs8.in%2F448.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/04/14747078.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中a标签触发图片和ajax请求被abort</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6中javascript文件开启Gzip出现代码不执行情况" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F902.html&from=http%3A%2F%2Fjs8.in%2F448.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6中javascript文件开启Gzip出现代码不执行情况</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IE6 PNG图片不透明问题的解决方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F380.html&from=http%3A%2F%2Fjs8.in%2F448.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/01/2770440.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IE6 PNG图片不透明问题的解决方法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://js8.in/448.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

