js获取IP地址

使用搜狐获取IP地址:

var returnCitySN = {"cip": "58.16.0.0", "cid": "500000", "cname": "贵州省"};

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <script src="http://pv.sohu.com/cityjson?ie=utf-8"></script> 
    <script type="text/javascript">  
        document.write('IP地址:' + returnCitySN["cip"] + ', CID:' + returnCitySN["cid"] + ', 地区:' + returnCitySN["cname"]);
    </script>
</head>

<body> 
</body>
</html>

 

 

posted @ 2017-03-25 11:39  落枫飘飘  阅读(6378)  评论(1编辑  收藏  举报