style.top style.left 在IE和FireFox的区别

在IE中可以直接用obj.style.top=100;但在FireFox中必须加上单位,变成obj.style.top=100+'px';
style.left同理。

浏览器的判断:window.navigator.userAgent.indexOf("IE") == -1 //非IE浏览器  FireFox,Chrome

FireFox没有onmouseover和onmouseout,onclick事件,他们的写法为:

if (window.navigator.userAgent.indexOf( " IE " ==   - 1 // FireFox
{
     link.addEventListener(
' mouseover ' function (){a  =   false },  true );
     link.addEventListener(
" mouseout " , function (){a  =   true }, true )
}
else   // IE
{
     link.attachEvent(
" onmouseover " , function (){a  =   false });
     link.attachEvent(
" onmouseout " , function (){a  =   true });
}

 

 

你可能感兴趣的:(firefox)