日期:2014-05-16  浏览次数:20372 次

使用javascript获取硬件信息
1.获取硬件列表

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

      <head>

            <title></title>

            <meta name="GENERATOR" content="Microsoft Visual Studio .NET

7.1">

            <meta name="vs_targetSchema"

content="http://schemas.microsoft.com/intellisense/ie5">

      <script id=clientEventHandlersJS language=javascript>

<!--

function Button1_onclick() {

      var locator = new ActiveXObject ("WbemScripting.SWbemLocator");

      var service = locator.ConnectServer(".");

      var properties = service.ExecQuery("SELECT * FROM

Win32_OnBoardDevice");

      var e = new Enumerator (properties);

      document.write("<table border=1>");

      for (;!e.atEnd();e.moveNext ())

      {

            var p = e.item ();

            document.write("<tr>");

            document.write("<td>" + p.Description + "</td>");

            document.write("<td>" + p.DeviceType + "</td>");

            document.write("<td>" + p.Enabled + "</td>");

            document.write("<td>" + p.Tag + "</td>");

            document.write("</tr>");

      }

      document.write("</table>");

}

//-->

</script>

</head>

      <body>

            <INPUT id="Button1" type="button" value="Button"

name="Button1" language=javascript onclick="return Button1_onclick()">

      </body>

</html>

2.Javascript获取CPU信息

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

      <head>

            <title></title>

            <meta name="GENERATOR" content="Microsoft Visual Studio .NET

7.1">

            <meta name="vs_targetSchema"

content="http://schemas.microsoft.com/intellisense/ie5">

      <script id=clientEventHandlersJS language=javascript>

<!--

function Button1_onclick() {

      var locator = new ActiveXObject ("WbemScripting.SWbemLocator");

      var service = locator.ConnectServer(".");

      var properties = service.ExecQuery("SELECT * FROM Win32_Processor");

      var e = new Enumerator (properties);<