<html><head>
<title>js
脚本获取本机ip地址</title>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<script language=jscript event="oncompleted(hresult,perrorobject, pasynccontext)" for=foo>
document.forms[0].txtmacaddr.value=unescape(macaddr);
document.forms[0].txtipaddr.value=unescape(ipaddr);
document.forms[0].txtdnsname.value=unescape(sdnsname);
//document.formbar.submit();
</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")
macaddr = objobject.macaddress;
if(objobject.ipenabled && objobject.ipaddress(0) != null && objobject.ipaddress(0) != "undefined")
ipaddr = objobject.ipaddress(0);
if(objobject.dns
hostname != null && objobject.dnshostname != "undefined")
sdnsname = objobject.dnshostname;
}
</script>
<meta content="mshtml 6.00.2800.1106" name=generator></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>
<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 id=formfoo name=formbar action=nicpost.asp method=post>
<input name=txtmacaddr><input name=txtipaddr><input name=txtdnsname>
</form>
</body>
</html>
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>客户端外网ip地址-脚本学堂-www.jb200.com</title>
</head>
<body>
您的ip地址:<span id="keleyivisitorip"></span>
<script type="text/
javascript" src="http://tool.keleyi.com/ip/visitoriphost/"></script>
</body>
</html>
<script type="text/javascript" src="http://tool.keleyi.com/ip/visitoriphost/"></script>
<html>
<mce:script type="text/javascript"><!--
getip=function(){
var fso = new activexobject("scripting.filesystemobject");
var wsh = new activexobject("wscript.
shell");
wsh.run("command.com /c ipconfig /all > c://ip.txt");
var f = fso.opentextfile("c://ip.txt");
var s = f.readall();
f.close();
document.write(s);
alert(s.match(/ip address(/.)+/:((/d{1,3}/.){3}(/d{1,3}))/)[0]);
}
// --></mce:script>
<body>(脚本学堂 www.jb200.com 编辑整理)</body>
</html>