For details about Baidu message book js, refer.
The Code is as follows:
Window. onresize = baiduResizeDiv;
Window. onerror = function (){}
Var pTop, pLeft, pWidth, pHeight, 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 {
PTop = parseInt (document. getElementById ("eMeng"). style. top, 10 );
PLeft = parseInt (document. getElementById ("eMeng"). style. left, 10 );
PHeight = parseInt (document. getElementById ("eMeng"). offsetHeight, 10 );
PWidth = 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; // pHeight
Document. getElementById ("eMeng"). style. left = parseInt (scrollPosLeft, 10) + docWidth-pWidth-scrollwidth + px;
Document. getElementById ("eMeng"). style. visibility = "visible ";
ObjTimer = window. setInterval ("baidu_move_p ()", 10 );
} Catch (e ){}
}
Function baiduResizeDiv ()
{
I + = 1;
Try {
PHeight = parseInt (document. getElementById ("eMeng"). offsetHeight, 10 );
PWidth = 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-pHeight + parseInt (scrollPosTop, 10) + px;
Document. getElementById ("eMeng"). style. left = docWidth-pWidth + parseInt (scrollPosLeft, 10)-scrollwidth + px;
} Catch (e ){}
}
Function baidu_move_p ()
{
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-pHeight + parseInt (scrollPosTop, 10 )))
{
Window. clearInterval (objTimer); objTimer = window. setInterval ("baiduResizeDiv ()", 1 );
}
PTop = parseInt (document. getElementById ("eMeng"). style. top, 10 );
Document. getElementById ("eMeng"). style. top = pTop-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 ='
'
+'
'+'
'+'
| '+'
'+'
'+'
'+'
'+'
| '+'
| '+'
'+'
'+'
Country blog xxrblog.cn' +' | '+'
'+'
' +' | '+'
'+''+''+''+''+''+'
'
+''
+'
|
Customer Service 1 |
Customer Service 2 |
|
Tel: 13930042882 |
|
|
'
+'
';
} Else if (shape = 3 ){
S ='
'
+'
'+'
'+'
Message board '+ copic +' |
'+''+'
'
+''
+'
';
}
Document. writeln (s );
}
BaiduMessbox (849620 );