获取当前ip和地址
2016-06-14 JQuery 1109
$(function(){
var html = $(".myip").text();
var pat = /\{.+\}/;
var ip = (new Function("return "+html.match(pat)))();
$(".myip").html("当前ip: "+ip.ip+" 所在地区: "+ip.address);
});
<span class="myip"><script type="text/javascript" src="http://ip.chinaz.com/getip.aspx"></script></span> <script> $(function(){ var html = $(".myip").text(); var pat = /\{.+\}/; var ip = (new Function("return "+html.match(pat)))(); $(".myip").html("当前ip: "+ip.ip+" 所在地区: "+ip.address); }); </script>
很赞哦! (0)
相关文章
文章评论
-
-
-
0条评论