前台JS
function GetLocalIPAddress()
{//IP
var obj = null;
var rslt = "";
try
{
obj = new ActiveXObject("rcbdyctl.Setting");
rslt = obj.GetIPAddress;
obj = null;
}
catch(e)
{
//异常发生
}
return rslt;
}
var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
var ip= GetLocalIPAddress();
var service = locator.ConnectServer(ip);
function cpuInfo() {//CPU 信息
var properties = service.ExecQuery("SELECT * FROM Win32_Processor");
var e = new Enumerator (properties);
for (;!e.atEnd();e.moveNext ())
{
var p = e.item ();
document.getElementById ("lblCPU").value=p.Name;
}
};
function mainBoard() {//主板信息
var properties = service.ExecQuery("SELECT * FROM Win32_BaseBoard");
var e = new Enumerator (properties);
var info="<table border=1>";
info+="<tr bgcolor='#CDEDED' style='font-weight: bold;'><td width='450'>主板信息 </td></tr>";
for (;!e.atEnd();e.moveNext ())
{
var p = e.item ();
document.getElementById("lblManufacturer").value= p.Manufacturer.replace(/[ ]/g,"");
}
};
function diskinfo() {//硬盘
var properties = service.ExecQuery("SELECT * FROM Win32_DiskDrive");
var e = new Enumerator (properties);