JS判断浏览器版本

 

 

var isIE = function(ver){
    var b = document.createElement('b')
    b.innerHTML = '<!--[if IE ' + ver + ']><i></i><![endif]-->'
    return b.getElementsByTagName('i').length === 1
}
if(isIE(6)){
    // IE 6
}
// ...
if(isIE(9)){
    // IE 9
}

if (isIE(6) || isIE(7) {
  //IE 6 、7
}

 

 

 

 

 

 

 

posted @ 2013-09-30 15:41  赵小磊  阅读(151)  评论(0)    收藏  举报
回到头部