1
function msieversion()
2
// Return Microsoft Internet Explorer (major) version number, or 0 for others.
3
// This function works by finding the "MSIE " string and extracting the version number
4
// following the space, up to the semicolon
5
{
6
var ua = window.navigator.userAgent
7
var msie = ua.indexOf ( "MSIE " )
8
if ( msie >= 0 ) // is Microsoft Internet Explorer; return version number
9
return parseFloat ( ua.substring ( msie+5, ua.indexOf ( ";", msie ) ) )
10
else
11
return 0 // is other browser
12
}
function msieversion()2
// Return Microsoft Internet Explorer (major) version number, or 0 for others.3
// This function works by finding the "MSIE " string and extracting the version number4
// following the space, up to the semicolon5
{6
var ua = window.navigator.userAgent7
var msie = ua.indexOf ( "MSIE " )8
if ( msie >= 0 ) // is Microsoft Internet Explorer; return version number9
return parseFloat ( ua.substring ( msie+5, ua.indexOf ( ";", msie ) ) )10
else11
return 0 // is other browser12
}
同样可以用这种方法判断是否为IE浏览器。
1
function isIE()
2
{
3
if(window.navigator.userAgent.indexOf("MSIE") >= 0)
4
return true;
5
else
6
return false;
7
}
function isIE()2
{3
if(window.navigator.userAgent.indexOf("MSIE") >= 0)4
return true;5
else6
return false;7
}


浙公网安备 33010602011771号