1.获取IP
<script type="text/javascript" src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script type="text/javascript">
alert(returnCitySN.cip);
<script>
2.获取地址
http://whois.pconline.com.cn/ipJson.jsp?callback=testJson&ip=IP地址
返回:if(window.testJson) {testJson({"ip":"222.185.132.247","pro":"江苏省","proCode":"320000","city":"常州市","cityCode":"320400","region":"","regionCode":"0","addr":"江苏省常州市 电信ADSL","regionNames":"","err":""});}
然后截取所需字段即可