私人资料库
本博客大部分技术文章,均从网络搜索得来,旨在收集整理技术资料,文章版权归属原作者,由此引起的任何版权问题,与本人无关。
 1function 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{
 6var ua = window.navigator.userAgent
 7var msie = ua.indexOf ( "MSIE " )
 8if ( msie >= 0 )        // is Microsoft Internet Explorer; return version number
 9return parseFloat ( ua.substring ( msie+5, ua.indexOf ( ";", msie ) ) )
10else
11return 0    // is other browser
12}


同样可以用这种方法判断是否为IE浏览器。

1function isIE()
2{
3    if(window.navigator.userAgent.indexOf("MSIE">= 0)
4        return true;
5    else
6        return false;
7}

 

posted on 2008-09-24 13:28  该显示名称已被其他用户使用  阅读(507)  评论(0)    收藏  举报