用于获取系统版本 博客分类: Web开发 windows
程序员文章站
2024-02-14 09:22:04
...
<script type="text/javascript">
//用于获取系统版本(注意:本方法对Firefox、Chrome无效)
var ua = window.navigator.userAgent;
var osVersion = ua.split(";")[2];
var osV = osVersion.substr(osVersion.length-3,3);
switch(osV)
{
case "5.0":
document.write("Windows2000");
break;
case "5.1":
document.write("WindowsXP");
break;
case "5.2":
document.write("Windows2003");
break;
case "6":
document.write("Windows Vista");
break;
case "6.1":
document.write("Windows 7");
break;
default:
document.write("Others");
}
</script>
//用于获取系统版本(注意:本方法对Firefox、Chrome无效)
var ua = window.navigator.userAgent;
var osVersion = ua.split(";")[2];
var osV = osVersion.substr(osVersion.length-3,3);
switch(osV)
{
case "5.0":
document.write("Windows2000");
break;
case "5.1":
document.write("WindowsXP");
break;
case "5.2":
document.write("Windows2003");
break;
case "6":
document.write("Windows Vista");
break;
case "6.1":
document.write("Windows 7");
break;
default:
document.write("Others");
}
</script>