Use javascript to implement QQ Customer Service Code

Source: Internet
Author: User

QQ customer service results are often seen on some websites. When the customer service personnel are online, QQ displayed on the webpage is online. When the customer service personnel are offline, QQ displayed on the webpage is offline, this is implemented through javascript.
<Script language = javascript>
Function picsize (obj, MaxWidth ){
Img = new Image (); // create an Image object. The width of this object will not be 0.
Img. src = "/fk/blog/obj. src ";
If (img. width> MaxWidth)
{
Return MaxWidth;
}
Else
{
Return img. width;
}
}
</Script>
<Style>
<! --
Div {font-size: 12px ;}
-->
</Style>
</Head>
<Body>
<SCRIPT>
Var online = new Array ();
If (! Document. layers)
Document. write ('<div id = "divStayTopLeft" style = "position: absolute"> ')
</SCRIPT>
<Layer id = "divStayTopLeft">
<Table border = "0" width = "110" cellspacing = "0" cellpadding = "0">
<Tr> <td width = "110"> </td> </tr>
<Script src = "http://webpresence.qq.com/getonline? Type = 1 & 391193603: 471133041: "> </script>

 

<! -- Set two QQ numbers, corresponding to the following two -->
<Tr> <td valign = middle background = "images/mid5.gif">
<Script>
If (online [0] = 0)
Document. write ("<div align = center> <a class = 'qqb'

 

Target = blank href = 'HTTP: // wpa.qq.com/msgrd? V = 1 & Uin = 391193603 & Site = online consulting & Menu = no 'title = 'customer service is not online. Please leave a message '> technician </a> </div> ");
Else
Document. write ("<div align = center> <a class = 'qqa'

 

Target = blank href = 'HTTP: // wpa.qq.com/msgrd? V = 1 & Uin = 391193603 & Site = online consulting & Menu = no' t

 

Itle = 'Instant chat'> technician </a> </div> ");
</Script>
</Td> </tr>
<Tr> <td valign = middle background = "images/mid5.gif">
<Script>
If (online [1] = 0)
Document. write ("<div align = center> <a class = 'qqb'

 

Target = blank href = 'HTTP: // wpa.qq.com/msgrd? V = 1 & Uin = 471133041 & Site = online consulting & Menu = no 'title = 'customer service is not online,

 

Please leave a message '> customer & nbsp; server </a> </div> ");
Else
Document. write ("<div align = center>

 

<A class = 'qqa' target = blank

 

Href = 'HTTP: // wpa.qq.com/msgrd? V = 1 & Uin = 471133041 & Site = online consulting & Menu = no 'title = 'Online instant chat'>

 

Customer & nbsp; server </a> </div> ");
</Script>
</Td> </tr>
<Tr> <td width = "110"> </td> </tr>
</Table>
<Script type = "text/javascript">
// Enter "frombottom" or "fromtop"
Var verticalpos = "frombottom"
If (! Document. layers)
Document. write ('</div> ')
Function JSFX_FloatTopDiv ()
// More javascript: http://www.webjx.com
{
Var startX = 6,
StartY = 150;
Var ns = (navigator. appName. indexOf ("Netscape ")! =-1 );
Var d = document;
Function ml (id)
{
Var el = d. getElementById? D. getElementById (id): d. all? D. all [id]: d. layers [id];
If (d. layers) el. style = el;
El. sP = function (x, y) {this. style. left = x; this. style. top = y ;};
El. x = startX;
If (verticalpos = "fromtop ")
El. y = startY;
Else {
El. y = ns? PageYOffset + innerHeight: document. body. scrollTop + document. body. clientHeight;
El. y-= startY;
}
Return el;
}
Window. stayTopLeft = function ()
{
If (verticalpos = "fromtop "){
Var pY = ns? PageYOffset: document. body. scrollTop;
FtlObj. y + = (pY + startY-ftlObj. y)/8;
}
Else {
Var pY = ns? PageYOffset + innerHeight: document. body. scrollTop + document. body. clientHeight;
FtlObj. y + = (pY-startY-ftlObj. y)/8;
}
FtlObj. sP (ftlObj. x, ftlObj. y );
SetTimeout ("stayTopLeft ()", 10 );
}
FtlObj = ml ("divStayTopLeft ");
StayTopLeft ();
}
JSFX_FloatTopDiv ();
</Script>
<Br>
<Br>
<Br>
<Br>
</Body>
</Html>

Related Article

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.