Js 구별 IE6,7,8


//      IE    
var ie = (" " + (/*@cc_on@_jscript_version@*/ - 1)).slice(-1);
// IE 6 : ie == 6
// IE 7 : ie == 7
// IE 8 : ie == 8

1、document.all 
2、!!window.ActiveXObject; 

      : 

if (document.all){ 
alert(”IE   ”); 
}else{ 
alert(” IE   ”); 
} 

if (!!window.ActiveXObject){ 
alert(”IE   ”); 
}else{ 
alert(” IE   ”); 
} 

     IE6、IE7、IE8     : 

<script type="text/javascript">
    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");
        }
    } 

</script>



좋은 웹페이지 즐겨찾기