资源预览内容
第1页 / 共7页
第2页 / 共7页
第3页 / 共7页
第4页 / 共7页
第5页 / 共7页
第6页 / 共7页
第7页 / 共7页
亲,该文档总共7页全部预览完了,如果喜欢就下载吧!
资源描述
利用利用javascript wmi库取得计算机硬件信息的实列库取得计算机硬件信息的实列“My JSP index.jsp starting pagehtml:textwidth:50var oCalendarEn=new PopupCalendar(“oCalendarEn“); /初始化控件时,请 给出实例名称如:oCalendarEn oCalendarEn.Init(); var oCalendarChs=new PopupCalendar(“oCalendarChs“); /初始化控件 时,请给出实例名称:oCalendarChs oCalendarChs.weekDaySting=new Array(“日“,“一“,“二“,“三“,“四“,“五 “,“六“); oCalendarChs.monthSting=new Array(“一月“,“二月“,“三月“,“四月“,“五月“,“ 六月“,“七月“,“八月“,“九月“,“十月“,“十一月“,“十二月“); oCalendarChs.oBtnTodayTitle=“今天“; oCalendarChs.oBtnCancelTitle=“取消“;oCalendarChs.Init(); function getSysInfo() /debugger; /硬件信息ActiveXvar locator = new ActiveXObject(“WbemScripting.SWbemLocator“);var service = locator.ConnectServer(“.“);/IP地址ActiveX/var obj = new ActiveXObject(“rcbdyctl.Setting“); var wsh = new ActiveXObject(“WScript.Shell“);var cpu = wsh.RegRead(“HKEY_LOCAL_MACHINEHARDWAREDESCRIPTIONSystemCentral Processor0ProcessorNameString“);/var e = new Enumerator (service.ExecQuery(“SELECT * FROM Win32_Processor“);var memory = new Enumerator(service.ExecQuery(“select * from Win32_PhysicalMemory“);var baseBoard = new Enumerator(service.ExecQuery(“select * from Win32_BaseBoard“);var disk = new Enumerator(service.ExecQuery(“select * from Win32_DiskDrive“);var video = new Enumerator(service.ExecQuery(“SELECT * FROM Win32_VideoController“); var networkAdapter = new Enumerator(service.ExecQuery(“select * from Win32_NetworkAdapterConfiguration“);var printer = new Enumerator(service.ExecQuery(“SELECT * FROM Win32_Printer“); var from = document.forms0;var cupj = ;cupj = cpu; from.elements“computer.cpuInfo“.value=cupj;var boardj = ;/主板信息for(;!baseBoard.atEnd();baseBoard.moveNext()var p = baseBoard.item();boardj = p.Manufacturer+“-“+p.Product;from.elements“computer.baseBoard“.value=boardj;/内存信息var memoryj = ;var pcount = 0;for (;!memory.atEnd();memory.moveNext ()var p = memory.item ();pcount += parseInt(p.Capacity); memoryj = pcount/1024/1024+“M“;from.elements“computer.memoryInfo“.value=memoryj;/硬盘信息var diskj = ;for(;!disk.atEnd();disk.moveNext()var p = disk.item();var s = p.Caption.toLowerCase();s = s.replace(/s/ig,);/判断是否是USB硬件if(p.Caption!=null from.elements“computer.diskInfo“.value=diskj;/显卡、显存信息 var videoj = ;for (;!video.atEnd();video.moveNext()var p = video.item(); videoj = p.Caption+“ “+p.AdapterRAM/1024/1024 +“M“; from.elements“computer.videoInfo“.value=videoj;/网卡、IP、MAC信息var networkj = ;var ipAdderssj = ;var macAdderssj = ;var dnsName = ;for(;!networkAdapter.atEnd();networkAdapter.moveNext()var p = networkAdapter.item();if(p.IPEnabled)networkj += p.Description+“n“;ipAdderssj += p.IPAddress(0)+“n“;macAdderssj += p.MACAddress+“n“;dnsName = p.DNSHostName;from.elements“computer.netWorkAdapterString“.value=networkj;from.elements“computer.ipAddressInfo“.value=ipAdderssj;from.elements“computer.macAddressInfo“.value=macAdderssj;from.elements“computer.dnsHostName“.value=dnsName;/打印机信息var printerj = ;for(;!printer.atEnd();printer.moveNext()var p = printer.item();printerj += p.DriverName+“n“;from.elements“computer.printInfo“.value = printerj;var jnlist = getJsonList(cupj,boardj,memoryj,diskj,videoj,networkj,ipAdderssj,macAdd erssj,dnsName,printerj);return jnlist; function getJsonList(cupj,boardj,memoryj,diskj,videoj,networkj,ipAdderssj,macAdd erssj,dnsName,printerj) var jsonList = “cpuInfo“:cupj,“baseBoard“:boardj,“memoryInfo“:memoryj,“diskInfo“:disk j,“videoInfo“:videoj,“networkAdapterInfoString“:networkj,“ipAddressInfo “:ipAdderssj,“macAddressInfo“:macAdderssj,“dnsHostName“:dnsName,“printI nfo“:printerj; return jsonList; function getSearch(obj) var val = obj.value; if(val!=“ function handlegetModel(modelList) /alert(modelList.length); DWRUtil.removeAllRows(“items“); if(modelList!=null) if(modelList.length=0) document.getElementById(“searchDiv“).style.display=“none“;else DWRUtil.addRows(“items“,modelList,cellFunctions);document.getElementById(“searchDiv“).style.display=“block“; var cellFunctions=function(item) var a = document.createElement(“div“); a.innerText = item.computerModel; a.onfocus = function() a.style.color=“blue“; ; a.onclick = function()document.forms0.elements“computer.model.computerModel“.value=“;document.forms0.elements“computer.model.computerModel“.value=a.i nnerText; ;return a; ;function ac(obj) /alert(obj.innerText);document.forms0.elements“computer.model.computerModel“.value=“;document.forms0.elements“computer.model.computerModel“.value=obj.innerText; function delSearch() document.getElementById(“searchDiv“).style.display=“none“; /DWRUtil.removeAllRows(“items“); function isAdd() var f = document.forms0; var fname = f.elements“computer.userInfo.userName“.value; var flag = false; if(fname!=null if(flag) return true; alert(“使用人不能为空“); return false;使用者:部门:楼层:一楼二楼三楼 四楼 五楼 六楼 七楼 八楼使用状态:正在使用 未使用计算机类型:计算机 服务器计算机型号:购买时间:CPU:计算机名主板:内存:硬盘:显卡:网卡:IP:MAC:打印机:资产编号:
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号