This article mainly introduces JS to obtain the IP address of the client card, MAC address method, the need for friends can refer to the following
Code as follows: <html> <head> <title></title> </head> <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> </ html> <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;& nbsp } </script> <script for= "foo" event= "oncompleted (Hresult,perrorobject, Pasynccontext)" Language= "JScript" > myform.macaddress.value=smacaddr; myform.ipaddress.value=sipaddr; myform.hostname.value=sdnsname; </script> Code is found on the internet, but has been modified. The reason is that you have more than one notebook.Network card, will appear to get you do not network or disable the network card information, the solution: Add restrictive conditions: objobject.dnsserversearchorder!=null Plus this restriction, You will be able to access the networking client's network card IP address. However, there is a problem that only Internet Explorer can be restricted, and ActiveX must be fully enabled.