var wwip= "";
$ (function () {
$ (document). Ready (function () {
$.getjson ("http://smart-ip.net/geoip-json?callback=?")
function (data) {
alert (data.host);
Wwip=data.host});
This problem to check a lot of information, can not, this is OK with.
Example, JS gets the local and extranet IP address.
<script language= "javascript" type= "Text/javascript" >
//Get local IP
function getlocalipaddress ()
{
var obj = null;
var rslt = "";
Try
{
obj = new ActiveXObject ("Rcbdyctl. Setting ");
Rslt = obj. getipaddress;
obj = null;
}
catch (E)
{
alert ("Errinfois:" +e)
} return
rslt;
}
document.write ("Your IP is:" + getlocalipaddress ());
</script>
The above is JS to obtain the local IP address method, see the following JS to obtain the external IP address example.
<script language= "JavaScript" >//Get extranet IP xml=new activexobject ("Microsoft.XMLHTTP
");
Xml.open ("Get", "http://city.ip138.com/city0.asp", false);
Xml.send (); Kk=xml.
ResponseText;
I=kk.indexof ("[");
Ie=kk.indexof ("]");
Ip=kk.substring (I+1,ie);
document.write ("<span style= ' color:red;font-size:12; ' cursor= ' hand ') > Your IP address is:" + IP + "</span>"); </script>