Copy Code code as follows:
<title></title>
<body>
<object classid= "Clsid:76a64158-cb41-11d1-8b02-00600806d9b6" id= "locator" style= "display:none;visibility": Hidden "></object>
<object classid= "clsid:75718c9a-f029-11d1-a1ac-00c04fb6c223" id= "foo" style= "Display:none;visibility:hidden" ></object>
<form name= "MyForm" >
<br/>mac Address: <input type= "text" name= "macAddress" >
<br/>ip Address: <input type= "text" Name= "IPAddress" >
<br/> Host Name: <input type= "text" name= "HostName" >
</form>
</body>
<script language= "JavaScript" >
var smacaddr= "";
var sipaddr= "";
var sdnsname= "";
var service = Locator. ConnectServer ();
Service. Security_. impersonationlevel=3;
Service. Instancesofasync (foo, ' Win32_NetworkAdapterConfiguration ');
</script>
<script for= "foo" event= "OnObjectReady (objobject,objasynccontext)" language= "JScript" >
if (objobject.ipenabled!= null && objobject.ipenabled!= "undefined" && objobject.ipenabled = = True) {
if (objobject.ipenabled && objobject.ipaddress (0)!=null && objobject.ipaddress (0)!= "undefined" & & Objobject.dnsserversearchorder!=null)
sipaddr = objobject.ipaddress (0);
if (objobject.macaddress!= null &&objobject.macaddress!= "undefined")
SMACADDR = objobject.macaddress;
if (objobject.dnshostname!= null &&objobject.dnshostname!= "undefined")
Sdnsname = Objobject.dnshostname;
}
</script>
<script for= "foo" event= "oncompleted (Hresult,perrorobject, Pasynccontext)" language= "JScript" >
MYFORM.MACADDRESS.VALUE=SMACADDR;
MYFORM.IPADDRESS.VALUE=SIPADDR;
Myform.hostname.value=sdnsname;
</script>
The code was found on the internet, but it was modified.
The reason is that your notebook has more than one network card, will appear to get you do not network or disable the network card information, the solution: Add Restrictions:
Objobject.dnsserversearchorder!=null
With this restriction, you will be able to access the networking client's network card IP address.
However, there is a problem that only the Internet Explorer can be restricted, and ActiveX must be fully enabled.