JavaScript 获取客户端计算机硬件及系统信息
2010-09-14 13:37:52 来源:WEB开发网WMI Win32类的完整信息及详细列表请参考MSDN:
http://msdn2.microsoft.com/en-us/library/aa394084(VS.85).aspx
示例:
1function button1_onclick() {//cpu 信息
2 var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
3 var service = locator.ConnectServer(".");
4 var properties = service.ExecQuery("SELECT * FROM Win32_Processor");
5 var e = new Enumerator (properties);
6 document.write("<table border=1>");
7 for (;!e.atEnd();e.moveNext ())
8 {
9 var p = e.item ();
10 document.write("<tr>");
11 document.write("<td>" + p.Caption + "</td>");
12 document.write("<td>" + p.DeviceID + "</td>");
13 document.write("<td>" + p.Name + "</td>");
14 document.write("<td>" + p.CpuStatus + "</td>");
15 document.write("<td>" + p.Availability + "</td>");
16 document.write("<td>" + p.Level + "</td>");
17 document.write("<td>" + p.ProcessorID + "</td>");
18 document.write("<td>" + p.SystemName + "</td>");
19 document.write("<td>" + p.ProcessorType + "</td>");
20 document.write("</tr>");
21 }
22 document.write("</table>");
23}
24
25function Button2_onclick() {//CD-ROM 信息
26 var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
27 var service = locator.ConnectServer(".");
28 var properties = service.ExecQuery("SELECT * FROM Win32_CDROMDrive");
29 var e = new Enumerator (properties);
30 document.write("<table border=1>");
31 for (;!e.atEnd();e.moveNext ())
32 {
33 var p = e.item ();
34 document.write("<tr>");
35 document.write("<td>" + p.Caption + "</td>");
36 document.write("<td>" + p.Description + "</td>");
37 document.write("<td>" + p.Drive + "</td>");
38 document.write("<td>" + p.Status + "</td>");
39 document.write("<td>" + p.MediaLoaded + "</td>");
40 document.write("</tr>");
41 }
42 document.write("</table>");
43}
44
45function Button3_onclick() {//键盘信息
46 var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
47 var service = locator.ConnectServer(".");
48 var properties = service.ExecQuery("SELECT * FROM Win32_Keyboard");
49 var e = new Enumerator (properties);
50 document.write("<table border=1>");
51 for (;!e.atEnd();e.moveNext ())
52 {
53 var p = e.item ();
54 document.write("<tr>");
55 document.write("<td>" + p.Description + "</td>");
56 document.write("<td>" + p.Name + "</td>");
57 document.write("<td>" + p.Status + "</td>");
58 document.write("</tr>");
59 }
60 document.write("</table>");
61}
62
63function Button4_onclick() {//主板信息
64 var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
65 var service = locator.ConnectServer(".");
66 var properties = service.ExecQuery("SELECT * FROM Win32_BaseBoard");
67 var e = new Enumerator (properties);
68 document.write("<table border=1>");
69 for (;!e.atEnd();e.moveNext ())
70 {
71 var p = e.item ();
72 document.write("<tr>");
73 document.write("<td>" + p.HostingBoard + "</td>");
74 document.write("<td>" + p.Manufacturer + "</td>");
75 document.write("<td>" + p.PoweredOn + "</td>");
76 document.write("<td>" + p.Product + "</td>");
77 document.write("<td>" + p.SerialNumber + "</td>");
78 document.write("<td>" + p.Version + "</td>");
79 document.write("</tr>");
80 }
81 document.write("</table>");
82}
83
84
Tags:JavaScript 获取 客户端
编辑录入:爽爽 [复制链接] [打 印]- ››JavaScript 判断浏览器是否支持SVG方法
- ››javascript自动改变文字大小和颜色的效果
- ››Javascript中产生固定结果函数的优化
- ››javascript 系统文件夹文件操作
- ››获取checkedListBox 选中的项并且移动
- ››Javascript 遮罩层和加载效果
- ››javascript创建二维码(Table/Canvas两种方式)
- ››JavaScript定时器详解
- ››javascript中可以直接写php代码
- ››javascript 按回车键相应按钮提交事件
- ››JavaScript中cookie的使用
- ››Javascript AMD模块化规范
更多精彩
赞助商链接