<%@ page contenttype="text/html; charset=utf-8"%>
<html>
<head>
<title>wmi scripting html</title>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<script type="text/
javascript" src="getipandmac.js"></script>
<script language=jscript
event="oncompleted(hresult,perrorobject, pasynccontext)" for=foo>
document.forms[0].txtmacaddr.value = unescape(macaddr);
document.forms[0].txtipaddr.value = unescape(ipaddr);
document.forms[0].txtdnsname.value = unescape(sdnsname);
//document.formbar.submit();
</script>
<script language=jscript event=onobjectready(objobject,objasynccontext)
for=foo>
if (objobject.ipenabled != null && objobject.ipenabled != "undefined"
&& objobject.ipenabled == true) {
if (objobject.macaddress != null && objobject.macaddress != "undefined")
macaddr = objobject.macaddress;
if (objobject.ipenabled && objobject.ipaddress(0) != null
&& objobject.ipaddress(0) != "undefined")
ipaddr = objobject.ipaddress(0);
if (objobject.dns
hostname != null
&& objobject.dnshostname != "undefined")
sdnsname = objobject.dnshostname;
}
</script>
</head>
<body>
<object id=locator classid=clsid:76a64158-cb41-11d1-8b02-00600806d9b6 viewastext></object>
<object id=foo classid=clsid:75718c9a-f029-11d1-a1ac-00c04fb6c223></object>
<script language=jscript>
var service = locator.connectserver();
var macaddr;
var ipaddr;
var domainaddr;
var sdnsname;
service.security_.impersonationlevel = 3;
service.instancesofasync(foo, 'win32_networkadapterconfiguration');
</script>
<form id=formfoo name=formbar action=macjsp.jsp method=post><input
value="" name="txtmacaddr"> <input value="" name="txtipaddr">
<input value="" name="txtdnsname" onclick="getipandmacaddress()"></form>
</body>
</html>