为 EMLOG 添加归属地

简爱代码>JavaScript2014-9-7 6:12930522

几行代码 为 EMLOG 添加来客,归属地显示
API 用的 新浪的,实现起来也非常简单,直接在后台 底部 信息添加 即可

代码如下 (需 jQuery)
<script>
$.getScript("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js", function() {
  if (remote_ip_info.province == remote_ip_info.city) city = remote_ip_info.city;
  else city = remote_ip_info.province + " " + remote_ip_info.city;
  userinfo = " <span style='clor:#08d'>欢迎来自 " + remote_ip_info.country + " " + city + " 的朋友</span> ";
  $(userinfo).prependTo("body:first").css({
    'position': 'fixed',
    'top': '5px',
    'left': '10%',
    'color': 'red',
    'padding': '5px 10px',
    'background-color': '#fff',
    'background': 'rgba(100,100,100,0.4) none repeat scroll 0 0!important',
    'box-shadow': '0 0 2px #000 inset,0 0 2px #000',
  });
});
</script>
样式什么自己在修改一下就可以了



效果预览

本文出自简爱博客,转载时请注明出处及相应链接。

评论

  1. zcshou2015-01-06 21:31回复

    看看代码

  2. 唐瑞2015-01-03 12:48回复

    来看看  欢迎欢迎回访

  3. 赵长收2015-01-02 23:49回复

    看看怎么样@@@@

  4. 唐瑞2015-01-01 16:29回复

    来看看  欢迎回访

  5. luo2014-12-24 10:17回复

    [可爱/]

  6. 9哥2014-12-22 12:51回复

    路过学习一下

  7. awrui2014-12-20 22:55回复

    没有来您的网站看过,来看看您,哈哈

  8. 塞德里克2014-11-26 04:15回复

    看看 学习下

  9. 麦陌瑞2014-11-24 14:40回复

    谢谢分享

  10. 小明2014-11-20 18:15回复

    又来了

发表评论

电子邮件地址不会被公开。必填项已用*标注