您好,欢迎来到源码搜藏!分享精神,快乐你我!提示:担心找不到本站?在百度搜索“源码搜藏”,网址永远不丢失!
  • 首 页
  • 在线工具
  • 当前位置:首页 > 网页特效 > 其他特效 >

    自定义QQ在线状态图片

    时间:2014-06-08 09:07 来源:互联网 作者:源码搜藏 浏览:收藏 挑错 推荐 打印

    运行代码保存代码复制代码 提示:您可以先修改部分代码再运行,保存代码功能在Firefox下无效。
    • QQ在线客服状态检测,自定义在线状态图片,可设置不同的QQ号码,号码专一存放在数组里,可以设置无限多个。不过太我的话检测起来就会费时间,甚至为造成网页假死哦。
    • <script type="text/javascript">
      //<![CDATA[
      var online = [];
      function QQPanel(id, data){
      if((this.id = this.get(id)) == null)return false;
      this.url = 'http://webpresence.qq.com/getonline?Type=1&';
      this.header = document.getElementsByTagName('head');
      this.items = this.id.childNodes;
      this.lens  = this.items.length;
      this.index = 0;
      this.data  = data;
      this.start();
      }
      QQPanel.prototype = {
      get: function(id){return document.getElementById(id);},
      start: function(){
      if(this.index >= this.lens)return this.running=false;
      this.running = true;
      var script  = document.createElement('script');
      script.type = 'text/javascript';
      script.src  = this.url + this.data[this.index] +':&'+(+new Date());
      this.header[0].appendChild(script);
      script.onload = script.onreadystatechange = (function(script){
      var _this = this;
      return (function(){
      if(script.readyState){
      if(script.readyState.match(/loaded|complete/i)){
      _this.show(script)
      _this = script = null;
      }
      }else{
      _this.show()
      _this = script = null;
      }
      });
      }).call(this, script);
      },
      show: function(s){
      this.items[this.index].className = '';
      this.items[this.index].title = '我不在线,有事请留言.';
      if(online[0] == 1){
      this.items[this.index].className = 'online';
      this.items[this.index].title = '我在线,有事您招呼.';
      }
      this.items[this.index].firstChild.href = 'tencent://message/?uin='+this.data[this.index++]+'&Site=小秦制作&Menu=yes';
      this.start();
      },
      reload: function(){
      if(this.running)return false;
      this.index = 0;
      this.start();
      }
      }
      var QQOnline = new QQPanel('QQPanel', [48080163, 276891949, 14944941, 1007051105]);
      setInterval(function(){//每隔10秒检测一次在线状态
      QQOnline.reload();
      }, 10000);
      //]]>
      </script>
    自定义QQ在线状态图片由源码搜藏网整理,转载请注明出处http://www.codesocang.com/texiao/qitatexiao/8554.html
    标签:网站源码