js实现PC端根据IP定位当前城市地理位置

 更新时间:2017年02月22日 15:18:05   作者:华ZhaoWeb  
本文主要分享了js实现PC端根据IP定位当前城市地理位置的方法,具有很好的参考价值,下面跟着小编一起来看下吧

话不多说,请看代码:

<script type="text/javascript">
 $.getScript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js', function(_result) {
 if (remote_ip_info.ret == '1') {
 alert('国家:' + remote_ip_info.country +'\n省:' + remote_ip_info.province + '\n市:' + remote_ip_info.city + '\n区:' + remote_ip_info.district + '\nISP:' + remote_ip_info.isp + '\n类型:' + remote_ip_info.type + '\n其他:' + remote_ip_info.desc);
 } else {
 alert('没有找到匹配的IP地址信息!');
 }
 });
</script>

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持脚本之家!

相关文章

最新评论