JS Judge customer service QQ number online or offline state of the method _javascript skills

Source: Internet
Author: User

This article is an example of JS Judge customer service QQ number online or off-line state of the method. Share to everyone for your reference. The specific analysis is as follows:

Do not know when to start, the original QQ with the online offline state of the code has been unable to accurately display online or offline state, and now use JS to determine the online offline status of QQ, according to the status of the output of online pictures or offline pictures.

Copy Code code as follows:
<script src= "Js/jquery-1.5.1.min.js" ></script>

<div class= "Kfli" onclick= "openqq (' 111111 ')" > Customer service One </div >
<div class= "Kfli" onclick= "openqq (' 222222 ')" > Customer service two </div >
<div class= "Kfli" onclick= openqq (' 333333 ') "> Customer service three </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>

This is the main judge whether the customer service online program, and then add the desired effect. Here's my little code:

Copy Code code as follows:
<script src= "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" ></div>
<div id= "Rightad" >
<span style= "color: #0f8ed2" > Close </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 ')" > Customer service One </div >
<div class= "Kfli" onclick= "openqq (' 222222 ')" > Customer service two </div >
<div class= "Kfli" onclick= openqq (' 333333 ') "> Customer service three </div >
<div class= "Kfli" onclick= "openqq (' 444444 ')" > Market one </div >
<div class= "Kfli" onclick= "openqq (' 555555 ')" > Market two </div >
<div class= "Kfli" onclick= "openqq (' 666666 ')" > Market three </div >
<div class= "Kfli" onclick= "openqq (' 777777 ')" > Market four </div >
<div class= "Kfli" onclick= "openqq (' 888888 ')" > Market five </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 ');
}
}

Turn off floating
$ (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>

I hope this article will help you with your JavaScript programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.