For details about Baidu message book js, refer

Source: Internet
Author: User

Copy codeThe Code is as follows:
Window. onresize = baiduResizeDiv;
Window. onerror = function (){}
Var divTop, divLeft, divWidth, divHeight, docHeight, docWidth, objTimer, I = 0;
Var px = document.doc type? "Px": 0;
Var scrollwidth = navigator. userAgent. indexOf ("Firefox")> 0? 16: 0;
Var iframeheight = navigator. userAgent. indexOf ("MSIE")> 0? 170--2;
String. prototype. Trim = function () {return this. replace (/^ \ s + | \ s + $/g ,"");}
Function baidu_collapse (obj ){
Ct = document. getElementById ('tab _ c_iframe ');
If (ct. style. display = "none "){
Ct. style. display = "";
Obj. src = obj. src. replace ("B .gif", "a.gif ");
} Else {
Ct. style. display = "none ";
Obj. src = obj. src. replace ("a.gif", "B .gif ");
}
BaiduResizeDiv ();
}

Function baiduMsg ()
{
Try {
DivTop = parseInt (document. getElementById ("eMeng"). style. top, 10 );
DivLeft = parseInt (document. getElementById ("eMeng"). style. left, 10 );
DivHeight = parseInt (document. getElementById ("eMeng"). offsetHeight, 10 );
DivWidth = parseInt (document. getElementById ("eMeng"). offsetWidth, 10 );

Var scrollPosTop, scrollPosLeft, docWidth, docHeight;
If (typeof window. pageYOffset! = 'Undefined '){
ScrollPosTop = window. pageYOffset;
ScrollPosLeft = window. pageXOffset;
DocWidth = window. innerWidth;
DocHeight = window. innerHeight;
} Else if (typeof document. compatMode! = 'Undefined' & document. compatMode! = 'Background '){
ScrollPosTop = document.doc umentElement. scrollTop;
ScrollPosLeft = document.doc umentElement. scrollLeft;
DocWidth = document.doc umentElement. clientWidth;
DocHeight = document.doc umentElement. clientHeight;
} Else if (typeof document. body! = 'Undefined '){
ScrollPosTop = document. body. scrollTop;
ScrollPosLeft = document. body. scrollLeft;
DocWidth = document. body. clientWidth;
DocHeight = document. body. clientHeight;
}

Document. getElementById ("eMeng"). style. top = parseInt (scrollPosTop, 10) + docHeight + 10 + px; // divHeight
Document. getElementById ("eMeng"). style. left = parseInt (scrollPosLeft, 10) + docWidth-divWidth-scrollwidth + px;
Document. getElementById ("eMeng"). style. visibility = "visible ";
ObjTimer = window. setInterval ("baidu_move_div ()", 10 );
} Catch (e ){}
}

Function baiduResizeDiv ()
{
I + = 1;
Try {
DivHeight = parseInt (document. getElementById ("eMeng"). offsetHeight, 10 );
DivWidth = parseInt (document. getElementById ("eMeng"). offsetWidth, 10 );

Var scrollPosTop, scrollPosLeft, docWidth, docHeight;
If (typeof window. pageYOffset! = 'Undefined '){
ScrollPosTop = window. pageYOffset;
ScrollPosLeft = window. pageXOffset;
DocWidth = window. innerWidth;
DocHeight = window. innerHeight;
} Else if (typeof document. compatMode! = 'Undefined' & document. compatMode! = 'Background '){
ScrollPosTop = document.doc umentElement. scrollTop;
ScrollPosLeft = document.doc umentElement. scrollLeft;
DocWidth = document.doc umentElement. clientWidth;
DocHeight = document.doc umentElement. clientHeight;
} Else if (typeof document. body! = 'Undefined '){
ScrollPosTop = document. body. scrollTop;
ScrollPosLeft = document. body. scrollLeft;
DocWidth = document. body. clientWidth;
DocHeight = document. body. clientHeight;
}

Document. getElementById ("eMeng"). style. top = docHeight-divHeight + parseInt (scrollPosTop, 10) + px;
Document. getElementById ("eMeng"). style. left = docWidth-divWidth + parseInt (scrollPosLeft, 10)-scrollwidth + px;
} Catch (e ){}
}

Function baidu_move_div ()
{

Var scrollPosTop, scrollPosLeft, docWidth, docHeight;
If (typeof window. pageYOffset! = 'Undefined '){
ScrollPosTop = window. pageYOffset;
ScrollPosLeft = window. pageXOffset;
DocWidth = window. innerWidth;
DocHeight = window. innerHeight;
} Else if (typeof document. compatMode! = 'Undefined' & document. compatMode! = 'Background '){
ScrollPosTop = document.doc umentElement. scrollTop;
ScrollPosLeft = document.doc umentElement. scrollLeft;
DocWidth = document.doc umentElement. clientWidth;
DocHeight = document.doc umentElement. clientHeight;
} Else if (typeof document. body! = 'Undefined '){
ScrollPosTop = document. body. scrollTop;
ScrollPosLeft = document. body. scrollLeft;
DocWidth = document. body. clientWidth;
DocHeight = document. body. clientHeight;
}

Try {
If (parseInt (document. getElementById ("eMeng"). style. top, 10) <= (docHeight-divHeight + parseInt (scrollPosTop, 10 )))
{
Window. clearInterval (objTimer); objTimer = window. setInterval ("baiduResizeDiv ()", 1 );
}
DivTop = parseInt (document. getElementById ("eMeng"). style. top, 10 );
Document. getElementById ("eMeng"). style. top = divTop-1 + px;
} Catch (e ){}
}
Function baiduMessbox (shape, color, userid ){
Var styles = 'position: absolute; top: 0px; left: 0px; z-index: 99999; visibility: hidden ;';
Var copic = ' ';
If (shape> 1) window. onload = baiduMsg;
Else {styles = ''; copic = ''}
Var s;
If (shape = 2 ){
S = '<div id = eMeng style = "Z-INDEX: 99999; LEFT: 0px; POSITION: absolute; TOP: 0px; VISIBILITY: hidden;">'
+ '<Table width = "216" border = "0" cellpadding = "0" cellspacing = "0" class = "" id = "tab _' + (color + 3) + '"style =" border: 0px; ">'
+ '<Tr>'
+ '<Td align = "right"> </td>'
+ '</Tr>'
+ '<Tr>'
+ '<Td> <table width = "100%" border = "0" cellspacing = "0" cellpadding = "0">'
+ '<Tr>'
+ '<Td width = "32" rowspan = "2" valign = "bottom"> </td>'
+ '<Td> </td>'
+ '</Tr>'
+ '<Tr>'
+ '<Td align = right style = "font-size: 12px; background: url (gbook/images/bg_'{color}'.gif); line-height: 21px; height: 21px; border-top: 1px solid #808080; border-right: 1px solid #808080; padding-right: 6px; color: # FFFFFF; "onDblClick =" baidu_collapse (this. firstChild. nextSibling) "> <a href =" http://www.xxrblog.cn "target =" _ blank "style =" text-decoration: none "> <font color =" # FFFFFF "> country blog xxrblog.cn </font> </a> '
+ '</Td>'
+ '</Tr>'
+ '</Table>'
+ '</Td>'
+ '</Tr>'
+''
+''
+''
+''
+''
+ '</Table>'

+ '<Iframe src = "gbook/side.html? Userid = '+ userid +' "width =" 216 "height =" '+ iframeheight +' "frameborder =" 0 "id =" tab_c_iframe "> </iframe>'
+ '<Table width = "216" border = "0" cellspacing = "0" cellpadding = "3" height = "69" style = "border-left-width: 1px; border-left-style: solid; border-left-color: #000; border-right-width: 1px; border-right-style: solid; border-right-color: #000; border-top-width: 0; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000; "> <tr> <td bgcolor =" # FFFFFF "> <table width =" 100% "border =" 0 "cellspacing =" 0 "cel Lpadding = "0" bgcolor = "# FFFFFF"> <tr> <td style = "height: 3px; "> </td> </tr> </table> <table width =" 100% "border =" 0 "cellpadding =" 0 "cellspacing =" 0 "style =" background: # E70010; "> <tr> <td width =" 31% "align =" center "valign =" middle "> </td> <table width = "100%" border = "0" cellspacing = "0" cellpadding = "0" style = "font- size: 12px; color: # FFFFFF; "> <tr> <td width = "38%" height = "22" valign = "bottom"> Customer Service 1 </td> <td width = "62%" valign = "bottom"> Customer Service 2 </td> </tr> <td height = "22" colspan = "2"> <a href = "tencent: // message /? Uin = 364738883 & Site = Country blog & Menu = yes "> </a> <a href = "msnim: chat? Contact = 24525533@163.com "> </a> </td> </tr> <td height = "22" colspan = "2" valign = "top"> Tel: 13930042882 </td> </tr> </table> <table width = "100%" border = "0" cellspacing =" 0 "cellpadding =" 0 "bgcolor =" # FFFFFF "> <tr> <td style =" height: 3px; "> </td> </tr> </table> <table width =" 100% "border =" 0 "cellpadding =" 0 "cellspacing =" 0 "style =" background: # E70010; "> </table> </td> </tr> </table>'
+ '</Div> ';
} Else if (shape = 3 ){
S = '<div id = eMeng style = "width: 100%; background: # FFFFFF;' + styles + '">'
+ '<Table width = "100%" border = "0" cellpadding = "0" cellspacing = "0" style = "border: 1px solid #808080; "id =" tab _ '+ color +' ">'
+ '<Tr>'
+ '<Td colspan = "3" align = right style = "font-size: 12px; background: url (gbook/images/bg_'{color}'.gif); line-height: 19px; height: 19px; padding-right: 6px; color: # FFFFFF; "onDblClick =" baidu_collapse (this. firstChild. nextSibling) "> message board '+ copic
+ '</Tr>'
+ '</Tr>'
+ '</Table>'
+ '<Iframe src = "bottom.html? Userid = '+ userid +' "width =" 100% "height =" 85 "frameborder =" 0 "id =" tab_c_iframe "> </iframe>'
+ '</Div> ';
}
Document. writeln (s );
}

BaiduMessbox (849620 );

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.