<HTML> <HEAD>
<TITLE> webpage special effects | JsCode. CN | --- a message similar to QQ or MSN is displayed in the lower right corner of the page. </TITLE>
<SCRIPT language = JavaScript>
<! --
/**//*
** ===================================================== ========================================================== ================================
** Class Name: CLASS_MSN_MESSAGE
** Function: provides message boxes similar to MSN.
** Example:
Bytes ---------------------------------------------------------------------------------------------------
Var MSG = new CLASS_MSN_MESSAGE ("aa", 200,120, "Short Message prompt:", "you have 1 message", "invite me to dinner today ");
MSG. show ();
Bytes ---------------------------------------------------------------------------------------------------
** Author: ttyp
* Mail: ttyp@21cn.com
** Date: 2005-3-18
** ===================================================== ========================================================== ================================
**/
/**//*
* Message structure
*/
Function CLASS_MSN_MESSAGE (id, width, height, caption, title, message, target, action ){
This. id = id;
This. title = title;
This. caption = caption;
This. message = message;
This.tar get = target;
This. action = action;
This. width = width? Width: 200;
This. height = height? Height: 120;
This. timeout = 150;
This. speed = 20;
This. step = 1;
This. right = screen. width-1;
This. bottom = screen. height;
This. left = this. right-this. width;
This. top = this. bottom-this. height;
This. timer = 0;
This. pause = false;
This. close = false;
This. autoHide = true;
}
/**//*
* Message hiding method
*/
CLASS_MSN_MESSAGE.prototype.hide = function (){
If (this. onunload ()){
Var offset = this. height> this. bottom-this.top? This. height: this. bottom-this.top;
Var me = this;
If (this. timer> 0 ){
Window. clearInterval (me. timer );
}
Var fun = function (){
If (me. pause = false | me. close ){
Var x = me. left;
Var y = 0;
Var width = me. width;
Var height = 0;
If (me. offset> 0 ){
Height = me. offset;
}
Y = me. bottom-height;
If (y> = me. bottom ){
Window. clearInterval (me. timer );
Me. Pop. hide ();
} Else {
Me. offset = me. offset-me. step;
}
Me. Pop. show (x, y, width, height );
}
}
This. timer = window. setInterval (fun, this. speed)
}
}
/**//*
* Message uninstallation event, which can be rewritten
*/
CLASS_MSN_MESSAGE.prototype.onunload = function (){
Return true;
}
/**//*
* Message command event. to implement your own connection, rewrite it.
*
*/
CLASS_MSN_MESSAGE.prototype.oncommand = function (){
// This. close = true;
This. hide ();
Window. open ("http://www.baidu.com ");
}
/**//*
* Message Display Method
*/
CLASS_MSN_MESSAGE.prototype.show = function (){
Var oPopup = window. createPopup (); // IE5.5 +
This. Pop = oPopup;
Var w = this. width;
Var h = this. height;
Var str = "<DIV style = 'border-RIGHT: #455690 1px solid; BORDER-TOP: # a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; BORDER-LEFT: # a6b4cf 1px solid; WIDTH: "+ w +" px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: "+ h +" px; BACKGROUND-COLOR: # c9d3f3 '>"
Str + = "<TABLE style = 'border-TOP: # ffffff 1px solid; BORDER-LEFT: # ffffff 1px solid 'cellspacing = 0 cellPadding = 0 width = '000000' bgColor = # cfdef4 border = 0>"
Str + = "<TR>"
Str + = "<TD style = 'font-SIZE: 12px; COLOR: # 0f2c8c' width = 30 height = 24> </TD>"
Str + = "<TD style = 'padding-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: # 1f336b; PADDING-TOP: 4px 'valign = middle width = '000000'> "+ this. caption + "</TD>"
Str + = "<TD style = 'padding-RIGHT: 2px; PADDING-TOP: 2px 'valign = middle align = right width = 19>"
Str + = "<SPAN title = close style = 'font-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px 'id = 'btsysclose'> × </SPAN> </TD>"
Str + = "</TR>"
Str + = "<TR>"
Str + = "<TD style = 'padding-RIGHT: 1px; PADDING-BOTTOM: 1px 'colspan = 3 height =" + (h-28) + ">"
Str + = "<DIV style = 'border-RIGHT: # b9c9ef 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 8px; FONT-SIZE: 12px; PADDING-BOTTOM: 8px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: # 1f336b; PADDING-TOP: 8px; BORDER-BOTTOM: # b9c9ef 1px solid; HEIGHT: 100% '> "+ this. title + "<BR>"
Str + = "<DIV style = 'word-BREAK: break-all 'align = left> <A href = 'javascript: void (0) 'hidefocus = false id = 'btcommand'> <FONT color = # ff0000> "+ this. message + "</FONT> </A> fghfghfghghghgh <A href = 'HTTP: // www.sohu.com 'hidefocus = false id = 'ommand '> <FONT color = # ff0000> dfgdfgg </FONT> </A> </DIV>"
Str + = "</DIV>"
Str + = "</TD>"
Str + = "</TR>"
Str + = "</TABLE>"
Str + = "</DIV>"
OPopup.doc ument. body. innerHTML = str;
This. offset = 0;
Var me = this;
OPopup.doc ument. body. onmouseover = function () {me. pause = true ;}
OPopup.doc ument. body. onmouseout = function () {me. pause = false ;}
Var fun = function (){
Var x = me. left;
Var y = 0;
Var width = me. width;
Var height = me. height;
If (me. offset> me. height ){
Height = me. height;
} Else {
Height = me. offset;
}
Y = me. bottom-me. offset;
If (y <= me. top ){
Me. timeout --;
If (me. timeout = 0 ){
Window. clearInterval (me. timer );
If (me. autoHide ){
Me. hide ();
}
}
} Else {
Me. offset = me. offset + me. step;
}
Me. Pop. show (x, y, width, height );
}
This. timer = window. setInterval (fun, this. speed)
Var btClose = oPopup.doc ument. getElementById ("btSysClose ");
BtClose. onclick = function (){
Me. close = true;
Me. hide ();
}
Var btCommand = oPopup.doc ument. getElementById ("btCommand ");
BtCommand. onclick = function (){
Me. oncommand ();
}
Var ommand = oPopup.doc ument. getElementById ("ommand ");
Ommand. onclick = function (){
// This. close = true;
Me. hide ();
Window. open (ommand. href );
}
}
/**//*
** Speed Setting Method
**/
CLASS_MSN_MESSAGE.prototype.speed = function (s ){
Var t = 20;
Try {
T = praseInt (s );
} Catch (e ){}
This. speed = t;
}
/**//*
** Step size setting method
**/
CLASS_MSN_MESSAGE.prototype.step = function (s ){
Var t = 1;
Try {
T = praseInt (s );
} Catch (e ){}
This. step = t;
}
CLASS_MSN_MESSAGE.prototype.rect = function (left, right, top, bottom ){
Try {
This. left = left! = Null? Left: this. right-this.width;
This. right = right! = Null? Right: this. left + this. width;
This. bottom = bottom! = Null? (Bottom> screen. height? Screen. height: bottom): screen. height;
This. top = top! = Null? Top: this. bottom-this. height;
} Catch (e ){}
}
Var MSG1 = new CLASS_MSN_MESSAGE ("aa", 200,120, "Short Message prompt:", "you have 1 message", "invite me to dinner today ");
MSG1.rect (null, screen. height-50 );
MSG1.speed = 10;
MSG1.step = 5;
// Alert (MSG1.top );
MSG1.show ();
// Two flashes at the same time, which can only be replaced by a layer, but the layer does not span the framework.
// Var MSG2 = new CLASS_MSN_MESSAGE ("aa", 200,120, "Short Message prompt:", "you have two messages", "OK ");
// MSG2.rect (100, null, null, screen. height );
// MSG2.show ();
// -->
</SCRIPT>
<META content = "MSHTML 6.00.2800.1106" name = GENERATOR> </HEAD>
<BODY> </HTML>