请问怎么通过javascript读当前的操作系统是98、winme还是2000、xp?

crinoid 2003-10-27 05:26:24
同上
谢谢!
...全文
55 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Kanderliu 2003-10-27
  • 打赏
  • 举报
回复
说明浏览器请在<body>与</body>之间加入:
<script language="JavaScript" >
<!--
window.document.write(navigator.appName)
//-->
</script>
<script language="JavaScript" >
<!--
window.document.write(parseInt(navigator.appVersion))
//-->
</script>
zhfkiller 2003-10-27
  • 打赏
  • 举报
回复
<HTML xmlns:IE>
<HEAD>
<STYLE>
@media all {
IE\:CLIENTCAPS {behavior:url(#default#clientCaps)}
}
</STYLE>

<SCRIPT>
function window.onload()
{
sTempStr = "availHeight = " + oClientCaps.availHeight + "\n" +
"availWidth = " + oClientCaps.availWidth + "\n" +
"bufferDepth = " + oClientCaps.bufferDepth + "\n" +
"colorDepth = " + oClientCaps.colorDepth + "\n" +
"connectionType = " + oClientCaps.connectionType + "\n" +
"cookieEnabled = " + oClientCaps.cookieEnabled + "\n" +
"cpuClass = " + oClientCaps.cpuClass + "\n" +
"height = " + oClientCaps.height + "\n" +
"javaEnabled = " + oClientCaps.javaEnabled + "\n" +
"platform = " + oClientCaps.platform + "\n" +
"systemLanguage = " + oClientCaps.systemLanguage + "\n" +
"userLanguage = " + oClientCaps.userLanguage + "\n" +
"width = " + oClientCaps.width + "\n" ;

oPre.innerText = sTempStr;
}
</SCRIPT>

</HEAD>
<BODY>
<H1>clientCaps Behavior Sample</H1>

<P>This example shows how to use the new <B>clientCaps</B>
behavior, introduced in Microsoft Internet Explorer 5, to obtain
client capabilities information. The following is a sampling of the
information that can be obtained:</P>

<IE:CLIENTCAPS ID="oClientCaps" />

<PRE id="oPre"></PRE>
</BODY>
</HTML>
kingdomzhf 2003-10-27
  • 打赏
  • 举报
回复
应该是这个
userAgent Property

--------------------------------------------------------------------------------

Retrieves a string equivalent to the HTTP user-agent request header.

Syntax

HTML N/A
Scripting [ sUserAgent = ] object.userAgent

Possible Values

sUserAgent String爐hat specifies a valid HTTP user agent.

The property is read-only. The property has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft?Internet Explorer 5. For more information, see Dynamic Properties.

Remarks

The HTTP user-agent request header contains information about compatibility, the browser, and the platform name. For more information about the browser, see the appName property. For more information about the platform, see the appVersion property.

The userAgent property dynamically returns a different value depending on the browser and platform versions. For example, Microsoft?Internet Explorer 4.01 returns the following string for Microsoft ?Windows?95.

Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)

Example

This example uses the userAgent property to specify a required platform before additional script is executed. For example, if Windows 95 is a requirement for the document, you can use a variable to determine whether the user is running the necessary operating system. The "bIs95" variable is set to true if Windows 95 is found in the userAgent value and the additional script is processed.

<SCRIPT>
var bIs95=false;
window.onload=fnInit;
function fnInit(){
if(navigator.userAgent.indexOf("Windows 95")>-1){
bIs95=true;
}
if(bIs95==true){
// Process additional script.
}
}
</SCRIPT>
Kanderliu 2003-10-27
  • 打赏
  • 举报
回复
说明操作系统请在<body>与</body>之间加入:
<script language="JavaScript" >
agent = navigator.userAgent; if (agent.lastIndexOf("Win95")) { document.write(' Windows 95/NT'); } else if (agent.lastIndexOf("Win16")) { document.write(' Windows 3.1'); } else if (agent.lastIndexOf("Mac")) { document.write(' Macintosh'); } else if (agent.lastIndexOf("Unix")) { document.write(' Unix'); } else if (agent.lastIndexOf("Linux")) { document.write(' Linux'); }
</script>
zhfkiller 2003-10-27
  • 打赏
  • 举报
回复
kingdomzhf 2003-10-27
  • 打赏
  • 举报
回复
window.clientInformation.platform



platform Property

--------------------------------------------------------------------------------

Retrieves the name of the user's operating system.

Syntax

HTML N/A
Scripting [ sPlatform = ] object.platform

Possible Values

sPlatform String that receives one of the following values:HP-UX HP Unix-based machines.
MacPPC Macintosh PowerPC-based machines.
Mac68K Macintosh 68K-based machines.
SunOS Solaris-based machines.
Win32 Microsoft?Windows?32-bit platform.
Win16 Windows 16-bit platform.
WinCE Windows CE platform.


The property is read-only. The property has no default value.

longshenwang 2003-10-27
  • 打赏
  • 举报
回复
我也想知道 帮你顶 ...
内容概要:本文聚焦风电出力的不确定性问题,采用拉丁超立方抽样(Latin Hypercube Sampling, LHS)方法生成具有统计代表性的风电出力初始场景集,有效克服传统蒙特卡洛抽样存在的样本冗余与收敛速度慢的缺陷。为进一步降低场景数量以提升电力系统优化调度的计算效率,研究结合K-means聚类、快速前向选择等场景缩减技术,对生成的高维场景进行聚合与概率修正,保留最具代表性的典型场景及其对应概率分布。整个建模流程在Matlab平台上编程实现,形成一套完整的“抽样—生成—缩减—验证”的不确定性建模框架,为含高比例风电的电力系统提供高质量、低冗余的输入场景集,显著增强随机优化、鲁棒优化等模型的求解效率与工程实用性。; 适合人群:具备电力系统分析、概率统计基础及Matlab编程能力,从事新能源并网、电力系统优化调度、不确定性建模与风险评估等方向的科研人员、工程技术人员及研究生。; 使用场景及目标:①应用于风电主导的电力系统随机优化调度、机会约束规划、鲁棒经济调度等场景,提升模型对不确定性的刻画能力;②帮助研究者深入掌握拉丁超立方抽样与场景缩减的核心原理与实现方法,构建高精度的不确定性输入模型;③为复杂电力系统仿真提供经过科学约简的典型场景集,平衡计算精度与效率,支撑实际工程决策。; 阅建议:建议者结合提供的Matlab代码逐模块调试与运行,重点理解LHS在多维空间中的分层抽样机制、场景距离度量方式及聚类缩减过程中的概率守恒原则,关注缩减前后场景集的分布保真性与计算效率提升效果,以全面掌握风电不确定性建模的关键技术路径。

87,987

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧