Copy codeThe Code is as follows:
/**
* The floating DIV regularly displays prompt information, such as Operation success or failure.
* @ Param string tips (content prompted)
* @ Param int height the height of the information displayed from the top of the browser
* @ Param int the time displayed (in seconds), time> 0
* @ Sample <a href = "javascript: void (0);" onclick = "showTips ('Operation successful ', 100, 3);"> click </a>
* @ Sample the code above indicates that the operation is successfully clicked for 3 seconds, PX away from the top
* @ Copyright ZhouHr 2010-08-27
*/
Function showTips (tips, height, time ){
Var export wwidth = document.doc umentElement. clientWidth;
Var tipsDiv = '<div class = "tipsClass">' + tips + '</div> ';
$ ('Body'). append (tipsDiv );
$ ('Div. tipsClass 'examples .css ({
'Top': height + 'px ',
'Left': (required wwidth/2)-(tips. length * 13/2) + 'px ',
'Position': 'absolute ',
'Padding': '3px 5px ',
'Background': '# 8FBC8F ',
'Font-size': 12 + 'px ',
'Marggin': '0 auto ',
'Text-align ': 'center ',
'Width': 'auto ',
'Color': '# fff ',
'Opacity ': '0. 8'
}). Show ();
SetTimeout (function () {$ ('div. tipsClass '). fadeOut () ;}, (time * 1000 ));
}