zoukankan      html  css  js  c++  java
  • javascript 通过IE ActiveX 获得本机内网ip

    <HTML><HEAD><TITLE>WMI Scripting HTML</TITLE>  
    <META http-equiv=Content-Type content="text/html; charset=gb2312">  
    <script type="text/javascript">
    function GetAdapterInfo() {
    
    	var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); 
    	var service = locator.ConnectServer("."); //连接本机服务器
    	var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled=TRUE"); 
    	//查询使用SQL标准
    	var e = new Enumerator (properties);
               var msg="";
    	for (;!e.atEnd();e.moveNext ()) 
    	{ 
    		var p = e.item ();
    		msg+="Caption:" + p.Caption + " "; //网卡描述,也可以使用Description
    		msg+="IP:" + p.IPAddress(0) + " ";//IP地址为数组类型,子网俺码及默认网关亦同
    		msg+="MAC:" + p.MACAddress + " "; //网卡物理地址 
    	}
              return msg;
    
    }
    alert( GetAdapterInfo());
    </script>
    <BODY>  
    </BODY>  
    </HTML> 
    
  • 相关阅读:
    mysql数据增删改查
    Python中的逻辑运算
    Python的格式化输出
    Python变量的命名规则
    解释型语言和编译型语言的比较?
    SQLAlchemy
    ansible
    算法
    数据分析
    scrapy之日志等级
  • 原文地址:https://www.cnblogs.com/sharpmap/p/3707532.html
Copyright © 2011-2022 走看看