本文為大家介紹下js如何獲取IP和PcName在IE下測試,代碼如下,有需要的朋友可以參考下,希望對大家有所幫助
復制代碼 代碼如下:
<!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>無標題頁</title>
<script type="text/javascript">
function getClientPcName()
{
var WshShellPcName = new ActiveXObject("WScript.Network");
var ComputerName = WshShellPcName.ComputerName ;
return ComputerName;
}
function getClientIp()
{
var WshShellIp = new ActiveXObject("rcbdyctl.Setting");
var ip = WshShellIp.GetIPAddress;
return ip;
}
alert(getClientPcName()+" "+getClientIp());
</script>
</head>
<body>
</body>
</html>
在vs中還可以用,發布到IIS下面就不行了,請高手提示。