function getSysInfo(){ var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); //CPU信息 var cpu = new Enumerator (service.ExecQuery("SELECT * FROM Win32_Processor")).item(); var cpuType=cpu.Name,hostName=cpu.SystemName; //内存信息 var memory = new Enumerator (service.ExecQuery("SELECT * FROM Win32_PhysicalMemory")); for (var mem=[],i=0;!memory.atEnd();memory.moveNext()) mem[i++]={cap:memory.item().Capacity/1024/1024,speed:memory.item().Speed} //系统信息 var system=new Enumerator (service.ExecQuery("SELECT * FROM Win32_ComputerSystem")).item(); var physicMenCap=Math.ceil(system.TotalPhysicalMemory/1024/1024),curUser=system.UserName,cpuCount=system.NumberOfProcessors
function button1_onclick() {//cpu 信息 var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); var properties = service.ExecQuery("SELECT * FROM Win32_Processor"); var e = new Enumerator (properties); document.write("
"); for (;!e.atEnd();e.moveNext ()) { var p = e.item (); document.write("
"); document.write("
" + p.Caption + "
"); document.write("
" + p.DeviceID + "
"); document.write("
" + p.Name + "
"); document.write("
" + p.CpuStatus + "
"); document.write("
" + p.Availability + "
"); document.write("
" + p.Level + "
"); document.write("
" + p.ProcessorID + "
"); document.write("
" + p.SystemName + "
"); document.write("
" + p.ProcessorType + "
"); document.write("
"); } document.write("
"); }
function Button2_onclick() {//CD-ROM 信息 var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); var properties = service.ExecQuery("SELECT * FROM Win32_CDROMDrive"); var e = new Enumerator (properties); document.write("
"); for (;!e.atEnd();e.moveNext ()) { var p = e.item (); document.write("
"); document.write("
" + p.Caption + "
"); document.write("
" + p.Description + "
"); document.write("
" + p.Drive + "
"); document.write("
" + p.Status + "
"); document.write("
" + p.MediaLoaded + "
"); document.write("
"); } document.write("
"); }
function Button3_onclick() {//键盘信息 var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); var properties = service.ExecQuery("SELECT * FROM Win32_Keyboard"); var e = new Enumerator (properties); document.write("
"); for (;!e.atEnd();e.moveNext ()) { var p = e.item (); document.write("
"); document.write("
" + p.Description + "
"); document.write("
" + p.Name + "
"); document.write("
" + p.Status + "
"); document.write("
"); } document.write("
"); }
function Button4_onclick() {//主板信息 var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); var properties = service.ExecQuery("SELECT * FROM Win32_BaseBoard"); var e = new Enumerator (properties); document.write("
"); for (;!e.atEnd();e.moveNext ()) { var p = e.item (); document.write("