Copy codeThe Code is as follows:
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml"> <HEAD> <TITLE> new document </TITLE>
<META http-equiv = Content-Type content = "text/html; charset = gb2312">
<META content = "MSHTML 6.00.2900.2180" name = GENERATOR>
<META content = "" name = author>
<META content = "" name = keywords>
<META content = "" name = description>
<STYLE type = text/css> # show_feedBack_message {
BORDER-RIGHT: # f00 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: # f00 1px solid; PADDING-LEFT: 3px; FONT-SIZE: 12px; BACKGROUND: # fc0; PADDING-BOTTOM: 3px; BORDER-LEFT: # f00 1px solid; LINE-HEIGHT: 18px; PADDING-TOP: 3px; BORDER-BOTTOM: # f00 1px solid
}
{
FONT-SIZE: 12px
}
Ol li {
MARGIN: 15px 0px
}
Ol li {
FONT-SIZE: 14px; COLOR: # 00f
}
</STYLE>
</HEAD>
<BODY>
<SCRIPT type = text/javascript>
<! --
/*
Message: the message to be displayed.
X, y: displays the coordinates of the message box. The default value is the upper left corner.
Delay: how long the delay will disappear.-1 indicates that the delay will never disappear, in milliseconds.
*/
Function feedBackMessage (message, x, y, delay ){
If (! Message) return;
// Only percentage or value parameters are allowed
X =/\ d {1, 2 }%| 100% | left | right/. test (x )? X :( parseInt (x) | 0) + "px ";
Y =/\ d {1, 2 }%| 100% | top | bottom/. test (y )? Y :( parseInt (y) | 0) + "px ";
Delay = parseInt (delay) |-1;
Var fdDiv = document. getElementById ('show _ feedBack_message ');
If (! FdDiv ){
Var showMessage = document. createElement ("<div id = 'show _ feedBack_message 'style = 'z-index: 10000; filter: alpha (opacity = 100); position: absolute; white-space: nowrap '> </div> ");
Document. body. appendChild (showMessage );
FdDiv = document. getElementById ('show _ feedBack_message ');
}
If (feedBackMessage. timer) {clearInterval (feedBackMessage. timer )}
FdDiv. innerHTML = message;
FdDiv. style. display = "";
Var docwidth?document.doc umentElement. scrollWidth> document.doc umentElement. clientWidth? Document.doc umentElement. scrollWidth: document.doc umentElement. clientWidth;
Var docheight?document.doc umentElement. scrollHeight> document.doc umentElement. clientHeight? Document.doc umentElement. scrollHeight: document.doc umentElement. clientHeight;
If (/left | right/. test (x )){
X = (x = "left ")? "0px" :( docWidth-fdDiv.offsetWidth) + "px ";
}
If (/top | bottom/. test (y )){
Y = (y = "top ")? "0px" :( docHeight-fdDiv.offsetHeight) + "px ";
}
FdDiv. style. left = x;
FdDiv. style. top = y;
FdDiv. filters. Alpha. Opacity = 100;
// Gradient effect
Var step = parseInt (delay/100 );
Var alpha = fdDiv. filters. Alpha. Opacity;
If (delay! =-1 ){
FeedBackMessage. timer = setInterval (function (){
If (fdDiv. filters. Alpha. Opacity> 0 ){
FdDiv. filters. Alpha. Opacity --
} Else {
ClearInterval (feedBackMessage. timer );
FdDiv. style. display = "none"
}
}, Step );
}
}
// -->
</SCRIPT>
<DIV style = "TEXT-ALIGN: center">
<DIV style = "MARGIN: 15px auto; WIDTH: 96%; TEXT-ALIGN: left">
<OL>
<LI> (set by default) display position: disappear time in the upper left corner: do not disappear <BR> <
Onclick = "feedBackMessage ('message prompt Test 1... '); return false"
Href = "#"> feedBackMessage ('message prompt test... ') </A>
<LI> display position: left: 200px, top: 200px disappear time: 5 seconds later <BR> <
Onclick = "feedBackMessage ('message prompt Test 1... ', '123456', '123456', 200); return false"
Href = "#"> feedBackMessage ('message prompt Test 1... ', '000000', '000000', 200) </A>
<LI> display position: disappears from the top right of the page after 3 seconds <BR> <
Onclick = "feedBackMessage ('message prompting Test 2... ', 'right', 'top', 3000); return false"
Href = "#"> feedBackMessage ('message prompting Test 2... ', 'right', 'top', 3000) </A>
<LI> display position: left: 50%, top: 50% disappear time: 2 seconds later <BR> <
Onclick = "feedBackMessage ('message prompt Test 3... ', '123456', '123456', 50%); return false"
Href = "#"> feedBackMessage ('message prompt Test 3... ', '000000', '000000', 50%) </A>
<LI> display position: left: 500px, top: 200px disappear time: not disappear <BR> <
Onclick = "feedBackMessage ('message prompting Test 4... ', '123456', '123456',-1); return false"
Href = "#"> feedBackMessage ('message prompt Test 4 ...... ', '20140901', '20140901',-1) </A> </LI> </OL> </DIV>
<DIV
Style = "FONT-SIZE: 14px; MARGIN: 15px auto; WIDTH: 96%; LINE-HEIGHT: 20px; TEXT-ALIGN: left"> function Syntax: feedBackMessage (Message, X, y, Delay)
<BR> <STRONG> parameter description: </STRONG> <BR> <U> Message: </U> required. This parameter is the message content to be displayed. It can be html content.
<BR> <U> X: </U> horizontal direction. It can be a numerical value such as 50,250, a percentage such as 50%, or the following two parameters: left (left side of the information box is next to the left side of the page), right (right side of the information box is next to the right side of the page ). The default value is left.
<BR> <U> Y: </U> vertical position, which can be a value, a percentage, or the following two parameters: top (the top of the information box is next to the top of the page) and bottom (the bottom of the information box is next to the bottom of the page ). The default value is top.
<BR> <U> Delay: </U> display time, that is, the time after which the message disappears, in milliseconds. For example, if the message is 5000, the message disappears after 5 seconds, if it is set to-1, it will never disappear. The default value is-1.
</DIV>
</BODY>
</HTML>
Online Demo http://demo.jb51.net/js/gmail_info/demo.htm