读书人

javascript判断FireFox跟IE

发布时间: 2012-11-16 14:12:15 作者: rapoo

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");

? }
}

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

?

读书人网 >JavaScript

热点推荐