<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>获取MAC地址</title>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1106" name="GENERATOR">
<SCRIPT language="JScript" event="OnCompleted(hResult,pErrorObject, pAsyncContext)" for="foo">
var objMacAddress = document.getElementById("labMAC");
objMacAddress.value = unescape(MACAddr);
</SCRIPT>
<SCRIPT language="JScript" event="OnObjectReady(objObject,objAsyncContext)" for="foo">
if(objObject.IPEnabled != null && objObject.IPEnabled != "undefined" && objObject.IPEnabled == true)
{
if(objObject.MACAddress != null && objObject.MACAddress != "undefined")
{
// var strMAC = objObject.MACAddress.replace(':','-').replace(':','-').replace(':','-').replace(':','-').replace(':','-');
var strMAC = objObject.MACAddress;
if(strMAC != "00-53-45-00-00-00")
MACAddr = strMAC;
}
}
</SCRIPT>
</HEAD>
<body MS_POSITIONING="GridLayout">
<OBJECT id="locator" classid="CLSID:76A64158-CB41-11D1-8B02-00600806D9B6" VIEWASTEXT>
</OBJECT>
<OBJECT id="foo" classid="CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223" VIEWASTEXT>
</OBJECT>
<SCRIPT language="JScript">
var service = locator.ConnectServer();
var MACAddr;
var IPAddr;
var DomainAddr;
var sDNSName;
service.Security_.ImpersonationLevel=3;
service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration');
</SCRIPT>
<form name="Form1" method="post" action="getmacaddress.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE" value="dDwtNTQwMDU0NjA3Ozs+fxL0EL5QuRxz6mVWTx//WjyPoDE=" />
<div align="center">
<span id="Label1"><b><font color="Red">MAC地址:</font></b></span>
<input name="labMAC" type="text" readonly="readonly" id="labMAC" /><br>
注意:请在IE中将站点添加为可信任站点
</div>
</form>
</body>
</HTML>