当前位置:主页 > javascript教程 > js实现PC端根据IP定位当前城市地理位置

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

发布:2020-01-22 16:29:08 51


给大家整理了javascript相关的编程文章,网友桓弘毅根据主题投稿了本篇教程内容,涉及到js、PC端、IP定位、js实现PC端根据IP定位当前城市地理位置相关内容,已被253网友关注,下面的电子资料对本篇知识点有更加详尽的解释。

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>

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


参考资料

相关文章

网友讨论