标签:
<pre name="code" class="html">不知道从什么时候开始,原来QQ官方自带的在线离线状态的代码已经不能准确显示在线或离线状态了,现在自己用JS判断QQ在线离线状态值,根据状态值输出在线图片还是离线图片。
<script src="http://www.xjzypm.com/JS/jquery-1.5.1.min.js"></script>
<div class="kfli" onclick="openQQ('111111')"><img src="/onlinekf/online.gif" border="0" /> 客服一</div> <div class="kfli" onclick="openQQ('222222')"><img src="/onlinekf/online.gif" border="0" /> 客服二</div> <div class="kfli" onclick="openQQ('333333')"><img src="/onlinekf/online.gif" border="0" /> 客服三</div>
<script> var online = new Array(); </script> <script type= "text/javascript" src="http://webpresence.qq.com/getonline?Type=1&111111:222222:333333:" ></script> <script type="text/javascript"> for (var i = 0; i < online.length; i++) { if (online[i] == 0) { $(".kfli img").eq(i).attr("src","/onlinekf/offline.gif"); } else { $(".kfli img").eq(i).attr("src",'/onlinekf/online.gif'); } } </script>
<script src="http://www.xjzypm.com/JS/jquery-1.5.1.min.js"></script> <style> #divMenu {position:fixed;top:220px;right:0px;_position:absolute; _top: cursor:pointer; display:none} #rightad {position:fixed;top:190px;right:7px;width:95px;height:180px;_position:absolute; font-size:12px;} #scrollto {position:fixed;bottom:100px; width:30px;right:0px;background:#368bcc;color:#FFF;cursor:pointer; text-align:center;_position:absolute; display:none} .kfli {height:30px; line-height:30px; color:#FFF; text-align:center;cursor:pointer; border-bottom:1px solid #fff} #leftad span,#rightad span{cursor:pointer;} </style> <div id="divMenu"><img src="/onlinekf/onlinerkf.png" class="press" alt="在线咨询"></div> <div id="rightad"> <span style="color:#0f8ed2">关闭</span> <div style="height:351px; background:url(/onlinekf/onkf.jpg) #368bcc; background-position:center top; background-repeat:no-repeat;width:91px"> <div style="height:90px; width:91px"> <div style="width:91px; height:91px; cursor:pointer"></div> <div class="kfli" onclick="openQQ('111111')"><img src="/onlinekf/online.gif" border="0" /> 客服一</div> <div class="kfli" onclick="openQQ('222222')"><img src="/onlinekf/online.gif" border="0" /> 客服二</div> <div class="kfli" onclick="openQQ('333333')"><img src="/onlinekf/online.gif" border="0" /> 客服三</div> <div class="kfli" onclick="openQQ('444444')"><img src="/onlinekf/online.gif" border="0" /> 市场一</div> <div class="kfli" onclick="openQQ('555555')"><img src="/onlinekf/online.gif" border="0" /> 市场二</div> <div class="kfli" onclick="openQQ('666666')"><img src="/onlinekf/online.gif" border="0" /> 市场三</div> <div class="kfli" onclick="openQQ('777777')"><img src="/onlinekf/online.gif" border="0" /> 市场四</div> <div class="kfli" onclick="openQQ('888888')"><img src="/onlinekf/online.gif" border="0" /> 市场五</div> </div> </div> </div> <script> var online = new Array(); </script> <script type= "text/javascript" src="http://webpresence.qq.com/getonline?Type=1&1844565410:363576965:2193744200:1315797152:1609979008:2690151979:3130711794:2825956442:" ></script> <script type="text/javascript"> for (var i = 0; i < online.length; i++) { if (online[i] == 0) { $(".kfli img").eq(i).attr("src","/onlinekf/offline.gif"); } else { $(".kfli img").eq(i).attr("src",'/onlinekf/online.gif'); } } //关闭浮动 $(document).ready(function () { $("#rightad span").click(function () { $("#rightad").hide(300); $("#divMenu").show(300); }); $("#divMenu").click(function () { $("#rightad").slideDown(300); $("#divMenu").hide(200); }); /* $("#rightad").mouseleave(function(){ $("#rightad").hide(200); $("#divMenu").show(300); }); */ }); window.onscroll = function () { if (document.documentElement.scrollTop + document.body.scrollTop > 100) { document.getElementById("scrollto").style.display = "block"; } else { document.getElementById("scrollto").style.display = "none"; } } function OpenSmallWindows(strURL, scrollbar, width, height, left, top) { window.open(strURL, "_blank", "status=no,resizable=0,toolbar=no,menubar=no,scrollbars=" + scrollbar + ",width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + ""); } function openQQ(qq) { window.location.href = "tencent://message/?uin=" + qq + "&Site=gbgjs.com&Menu=yes"; } </script>
标签:
原文地址:http://blog.csdn.net/ywq5752952/article/details/42291153