1、rcbdyctl
view plaincopy to clipboardprint?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<title>JS获取客户端IP</title>
</head>
<body>
<mce:script type="text/javascript" language="javascript"><!--
function GetLocalIPAddress()
{
var obj = null;
var rslt = "";
try
{
obj = new ActiveXObject("rcbdyctl.Setting");
rslt = obj.GetIPAddress+":"+obj.CreatePassword;
obj = null;
}
catch(e)
{
//异常发生
}
return rslt;
}
document.write("你的IP是:" + GetLocalIPAddress());
// --></mce:script>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<title>JS获取客户端IP</title>
</head>
<body>
<mce:script type="text/javascript" language="javascript"><!--
function GetLocalIPAddress()
{
var obj = null;
var rslt = "";
try
{
obj = new ActiveXObject("rcbdyctl.Setting");
rslt = obj.GetIPAddress+":"+obj.CreatePassword;
obj = null;
}
catch(e)
{
//异常发生
}
return rslt;
}
document.write("你的IP是:" + GetLocalIPAddress());
// --></mce:script>
</body>
</html>
2、ocx
view plaincopy to clipboardprint?
<html>
<head>
<title>wmi scripting html</title>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<mce:script language=javascript event="oncompleted(hresult,perrorobject, pasynccontext)" for=foo><!--
document.forms[0].txtipaddr.value=unescape(ipaddr);
document.forms[0].txtdnsname.value=unescape(sdnsname);
// --></mce:script>
<mce:script language=javascript event=onobjectready(objobject,objasynccontext) for=foo><!--
if(objobject.ipenabled != null && objobject.ipenabled != "undefined" && objobject.ipenabled == true)
{
if(objobject.ipenabled && objobject.ipaddress(0) != null && objobject.ipaddress(0) != "undefined")
ipaddr = objobject.ipaddress(0);
if(objobject.dnshostname != null && objobject.dnshostname != "undefined")
sdnsname = objobject.dnshostname;
}
// --></mce:script>
</head>
<body>
<object id=locator classid=clsid:76a64158-cb41-11d1-8b02-00600806d9b6 viewastext></object>
<object id=foo classid=clsid:75718c9a-f029-11d1-a1ac-00c04fb6c223></object>
<mce:script language=javascript><!--
var service = locator.connectserver();
var ipaddr ;
var sdnsname;
service.security_.impersonationlevel=3;
service.instancesofasync(foo, 'win32_networkadapterconfiguration');
// --></mce:script>
<form id=formfoo name=formbar>
<input value=192.168.0.2 name=txtipaddr>
<input value=type name=txtdnsname>
</form>
</body>
</html>