在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});
}

相关文章:

  • 2022-12-23
  • 2022-01-29
  • 2022-03-04
  • 2021-08-08
  • 2021-11-23
  • 2022-12-23
  • 2022-01-24
猜你喜欢
  • 2021-11-23
  • 2022-01-05
  • 2021-12-23
  • 2022-12-23
相关资源
相似解决方案