谷歌的ie9.js ie8.js ie7.js 解决IE5、IE6、IE7、IE8与W3C标准的冲突

20 篇文章 0 订阅

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

如果分别用IE5、IE6、IE7浏览同一个网页,将可能出现不一样的效果。
这是它们之间对CSS的解析选择器不一样或错误和个别bug所导致。为了解决这些错误和bug。
我们不得不找到一个能平衡于它们之间的解决方法。

如png透明问题在IE5、IE6下无法显示出其效果,我们可能会使用CSS hack或者引入外部JavaScript来实现。譬如前面我提到过用pngfix的那个方法就是调用外部JavaScript来解决在IE5、IE6下png透明问题。当然还有更多的方法。

而现在有种更加完美的方法能兼容IE5、IE6、IE7的CSS选择器解析不一样问题。那就是: ie7 – js

ie7 – js中是一个JavaScript库(解决IE与W3C标准的冲突的JS库),使微软的Internet Explorer的行为像一个Web标准兼容的浏览器,支持更多的W3C标准,支持CSS2、CSS3选择器。它修复了许多的HTML和CSS问题,并使得透明PNG在IE5、IE6下正确显示。

目前该ie7 – js版本: 2.0 beta 3

用法:
直接引用Google Code服务器上的js文件。

 

<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE7.js">IE7_PNG_SUFFIX=".png";</script>
<![endif]-->
<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js">IE7_PNG_SUFFIX=".png";</script>
<![endif]-->
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js">IE7_PNG_SUFFIX=".png";</script>
<![endif]-->

 

 

 

 


IE7.js
使IE5、IE6升级至兼容IE7
注释使Internet Explorer版本号低于IE7的IE浏览器载入该代码。

<!–[if lt IE 7]>
<script src=”http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js” type=”text/javascript”></script>
<![endif]–>

 

IE8.js
使IE5、IE6、IE7支持更多的W3C标准(修复了许多的HTML和CSS问题)。
注释使Internet Explorer版本号小于8的IE浏览器载入该代码,而其它符合标准的浏览器则会忽略该代码,并在IE8出来后不干扰其工作。

<!–[if lt IE 8]>
<script src=”http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js” type=”text/javascript”></script>
<![endif]–>

 

让png透明的语句.
<script src="IE8.js">IE7_PNG_SUFFIX=".png";</script>


E7.js is a JavaScript library to make Microsoft Internet Explorer behave like a standards-compliant browser. It fixes many HTML and CSS issues and makes transparent PNG work correctly under IE5 and IE6.

Status
Current version: 2.1 beta4.

Usage
IE7.js
Upgrade MSIE5.5-6 to be compatible with MSIE7.

<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE7.js"></script>
<![endif]-->
IE8.js
Upgrade MSIE5.5-7 to be compatible with MSIE8.

<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script>
<![endif]-->
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.

<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
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.js script. Alternatively, you can set the variable inside the IE7.js script element:

<script src="IE8.js">IE7_PNG_SUFFIX=".png";</script>
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

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值