javascript獲取ip地址 js中怎么取得本機的ip地址?
js中怎么取得本機的ip地址?/** * 獲取本地IP地址 */ function getLocalIPAddress() { var obj = null var rslt = "127.0
js中怎么取得本機的ip地址?
/**
* 獲取本地IP地址
*/
function getLocalIPAddress()
{
var obj = null
var rslt = "127.0.0.1"
try
{
obj = new ActiveXObject("rcbdyctl.Setting")
if (!isNull(obj.GetIPAddress))
{
rslt = obj.GetIPAddress
}
obj = null
}
catch(e)
{
//異常發(fā)生
}
return rslt
}