当前位置: 代码迷 >> JavaScript >> javascript判断FireFox跟IE
  详细解决方案

javascript判断FireFox跟IE

热度:148   发布时间:2012-11-16 14:12:15.0
javascript判断FireFox和IE

如何判断是IE或者是FireFox呢? 我用最简单的例子说一下.

?

FF = (navigator.userAgent.indexOf("Firefox")!=-1);
IE = (navigator.userAgent.indexOf("MSIE")!=-1);

?

function test() {
? if(IE){
??? alert("is IE");

? }else{
??? alert("is not?IE");

? }
}

?

function test_1() {
? if(FF){
? ?alert("is FF");

? }else{
??? alert("is not?FF");

? }
}

调试一下就知道怎么用了.

?

  相关解决方案