document.all

来源:互联网 发布:手机用户mac绑定错误 编辑:程序博客网 时间:2024/05/16 10:46
一种一般用作识别IE浏览器的方法. 


可以判断兼容性 
IE下 
if(document.all) 
返回 true 
firefox下 
if(document.all) 
返回 false 

感谢 sohighthesky 分享的方法 

sohighthesky 写道
识别ie我用 
window.ActiveXObject 
!+'\v1' 
!-[1,] 
现在更喜欢用短的了


引用

!!window.ActiveXObject&&!window.XMLHttpRequest 


var isIE=!!window.ActiveXObject; 
var isIE6=isIE&&!window.XMLHttpRequest; 
var isIE8=isIE&&!!document.documentMode; 
var isIE7=isIE&&!isIE6&&!isIE8; 
if (isIE){ 
if (isIE6){ 
alert(”ie6″); 
}else if (isIE8){ 
alert(”ie8″); 
}else if (isIE7){ 
alert(”ie7″); 

0 0
原创粉丝点击