javascript可以获得mac地址

javascript可以获得mac地址【普索】[url]http://www.pusuo.net[/url]


代码如下,应该是很简单的英文啦:

Advanced JavaScript with Internet Explorer: Retrieving Networking Configuration Information - How to retrieve MAC address and other extended network information using JavaScript

(Page 2 of 6 )

Now, let us try to extend the previous sample by showing further information about the network adapters. The entire code for the sample is as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.
microsoft.com/intellisense/ie5">
<script id="clientEventHandlersJS" language="javascript">
<!--

function Button1_onclick() {
var locator = new ActiveXObject
"WbemScripting.SWbemLocator");
var service = locator.ConnectServer(".");
var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
var e = new Enumerator (properties);
document.write("<table border=1>");
dispHeading();
for (;!e.atEnd();e.moveNext ())
{
var p = e.item ();
document.write("<tr>");
document.write("<td>" + p.Caption + "</td>");
document.write("<td>" + p.IPFilterSecurityEnabled + "</td>");
document.write("<td>" + p.IPPortSecurityEnabled + "</td>");
document.write("<td>" + p.IPXAddress + "</td>");
document.write("<td>" + p.IPXEnabled + "</td>");
document.write("<td>" + p.IPXNetworkNumber + "</td>");
document.write("<td>" + p.MACAddress + "</td>");
document.write("<td>" + p.WINSPrimaryServer + "</td>");
document.write("<td>" + p.WINSSecondaryServer + "</td>");
document.write("</tr>");
}
document.write("</table>");
}

function dispHeading()
{
document.write("<thead>");
document.write("<td>Caption</td>");
document.write("<td>IPFilterSecurityEnabled</td>");
document.write("<td>IPPortSecurityEnabled</td>");
document.write("<td>IPXAddress</td>");
document.write("<td>IPXEnabled</td>");
document.write("<td>IPXNetworkNumber</td>");
document.write("<td>MACAddress</td>");
document.write("<td>WINSPrimaryServer</td>");
document.write("<td>WINSSecondaryServer</td>");
document.write("</thead>");
}

//-->
</script>
</head>
<body>
<INPUT id="Button1" type="button" value="Button"
name="Button1" language="javascript" οnclick="return Button1_onclick()">
</body>
</html>

The explanation for the above code is very similar to that of the previous section. The only difference is that I added few more properties to get in-depth network configuration information.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值