function MacInfo(){ //访问到WbemScripting对象 var locator =new ActiveXObject ("WbemScripting.SWbemLocator"); //访问本地电脑 var service = locator.ConnectServer("."); //获取我们需要的对象的记录集 var properties = service.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled =True"); var e =new Enumerator (properties); var p = e.item(); var mac = p.MACAddress; return mac; }