完美解决IE6不支持PNG和hover等BUG兼容到IE7,IE8,IE9

一直没用Google code,用了才知道Google的强大之处!

Google代码里很有很多开源的项目,还有一些牛人分享的JS代码

我发现一段代码只要沾到你的页面中去就可以完美的解决IE6上的一下BUG

只是可以解决PNG不透明,tr:hover等无效的BUG

使用办法如下:

http://code.google.com/p/ie7-js/
IE7.js

Upgrade MSIE5.5-6 to be compatible with MSIE7.

<br />
&lt;!--[if lt IE 7]&gt;<br />
&lt;script src=&quot;http://ie7-js.googlecode.com/svn/version/2.1(beta2)/IE7.js&quot;&gt;&lt;/script&gt;<br />
&lt;![endif]--&gt;

IE8.js

Upgrade MSIE5.5-7 to be compatible with MSIE8.

&lt;!--[if lt IE 8]&gt;<br />
&lt;script src=&quot;http://ie7-js.googlecode.com/svn/version/2.1(beta2)/IE8.js&quot;&gt;&lt;/script&gt;<br />
&lt;![endif]--&gt;

You do not need to include IE7.js if you are using IE8.js

IE9.js

Upgrade MSIE5.5-8 to be compatible with modern browsers.

&lt;!--[if lt IE 9]&gt;<br />
&lt;script src=&quot;http://ie7-js.googlecode.com/svn/version/2.1(beta2)/IE9.js&quot;&gt;&lt;/script&gt;<br />
&lt;![endif]--&gt;

You do not need to include IE7/IE8.js if you are using IE9.js PNG The script only fixes images named: *-trans.png If you want the fix to apply to all PNG images then set a global variable as follows: var IE7_PNG_SUFFIX = “*.png”; You must set this variable before including the IE7 script. Alternatively, you can set the variable inside the IE7 script element:
The suffix will ignore query string parameters. For more fine-grained control you can also set IE7_PNG_SUFFIX to a RegExp object. If you want to use an alternative PNG solution then set the suffix to something that cannot possibly match:

var IE7_PNG_SUFFIX = “:”;
By default, the PNG will be stretched (this simulates tiling). If you want to turn this off then set the no-repeat property as follows:

div.example {
background: url(my-trans.png) no-repeat;
}
Unfortunately, the transparent background image cannot be tiled (repeated) using background-repeat. Nor can it be positioned using background-position.

Download

You may link directly to these files if you wish:

http://ie7-js.googlecode.com/svn/version/

Or go to the downloads section to download the current version.

Getting Started

Here is a nice introduction:

http://www.charlescooke.me.uk/web/lab_notes/ie7_script.html

Demo

http://ie7-js.googlecode.com/svn/test/index.html

The demo pages are currently not reflecting the latest changes. Hopefully this will resolve itself in the next couple of days.

anyShare分享到: