JDP 發表於 2005-12-28 14:24:30

判斷Browser是IE還是FireFox

// IE navigator.appName = "Microsoft Internet Explorer" navigator.appVersion = 4
// FireFox navigator.appName = "Netscape" navigator.appVersion = 5

IE4 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4);
NN4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);

後續使用方法:
if (IE4) xxxxxxxxxxxxxxxx;
else if (NN4) xxxxxxxxxxxxxx;
頁: [1]
查看完整版本: 判斷Browser是IE還是FireFox