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)

{

//异常发生

}

return rslt

}