function GetNetConfig() {
try {
var value = "";
var locator = new ActiveXObject("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("127.0.0.1");
var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
var e = new Enumerator(properties);
// alert(e.item()); //出问题的机器上这里报错undefine for (; !e.atEnd(); e.moveNext()) {
var p = e.item();
if (p.IPEnabled && p.IPAddress(0) != null && p.IPAddress(0) != "undefined" && p.IPAddress(0) != "0.0.0.0") {
value += p.MACAddress + "|";
}
}
}
catch (ex) {
alert("获取网卡信息异常:");
}
finally {
alert(value);
}
}
js代码如上,大部分机器上都没问题,但是有个客户电脑上无论如何value都是空的,恳求高手指点。
2 我建了个html文件在客户机器上打开测试的,这个应该和安全无关吧。