码迷,mamicode.com
首页 > 其他好文 > 详细

火狐和IE浏览器的兼容问题汇总

时间:2016-03-14 18:23:00      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

1.window.event

    code=(navigator.appName="Netscape")?event.which:event.keycode;

2.event.x

    mx=event.x?event.x:event.pageX(火狐)

3.IE:event.srcElement  ;

   Firefox:event.target;

4.cursor:hand(仅适用与IE); cursor:pointer;支持所有浏览器

5.innerText与textContent

  if(navigator.appName.indexOf("Explorer")>-1){

       document.getElementById("element").innerText="a";

   }else{

       document.getElementById("element").textContent="a";

   }

6.padding:5px 4px 3px 2px;(火狐不支持,需分别设置)

7.XMLHTTP(XMLHttpRequest/ActiveXObject);

8.CSS hack:

  ①.css内部hack

IE6 IE7
+ IE7
- IE6
!important IE7 IE8 IE9 IE10 及其他浏览器
\9 IE系列浏览器
\0 IE8 IE9 IE10
\9\0

IE9 IE10

       用法:selector{<hack>?property:value<hack>};

         例:background-color:#0f0\9;

              +background-color:#0f0;

   ②选择器hack(主要针对IE浏览器)

*html IE6
*+html IE7
:root IE9

      用法:<hack>selector{  }

        例::root .test{background-color:#0f0;}

    ③HTML头部引用(只能用在HTML文件里,只有在IE浏览器下才能执行)

lte 小于或等于
lt 小于
gte 大于或等于
gt 大于
不等于

       例:<link rel="stylesheet" type="text/css" href="myCss.css"/>

             <!-[if  lte IE9]>

                 <link rel="stylesheet" type="text/css" href="myIE.css"/>

             <![endif]->

 

火狐和IE浏览器的兼容问题汇总

标签:

原文地址:http://www.cnblogs.com/yxxxx/p/5276276.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!