读书人

JUQERY兑现的提示信息页

发布时间: 2012-09-02 21:00:34 作者: rapoo

JUQERY实现的提示信息页

/** * 浮动DIV定时显示提示信息,如操作成功, 失败等 * @param string tips (提示的内容) * iWidth;                          //弹出窗口的宽度;* iHeight;                         //弹出窗口的高度;   * @param int time 显示的时间(按秒算), time > 0 */ function showTips( tips, time ,iWidth,iHeight){ var windowWidth = document.documentElement.clientWidth; var tipsDiv = '<div class="tipsClass">' + tips + '</div>'; $( 'body' ).append( tipsDiv ); $( 'div.tipsClass' ).css({ 'top' :(window.screen.availHeight-30-iHeight)/2 + 'px', 'left' :  (window.screen.availWidth-10-iWidth)/2 + 'px', 'position' : 'absolute', 'padding' : '3px 5px', 'background': '#F2F6F9', 'font-size' : 15 + 'px', 'margin' : '0 auto', 'text-align': 'center', 'width' : 'auto', 'color' : '#000','font-weight': 'bolder', 'opacity' : '0.8','border': '2px solid #34A7DB'}).show(); setTimeout( function(){$( 'div.tipsClass' ).fadeOut();}, ( time * 1000 ) ); } 

?调用方法:

showTips( '此功能【'+name+'】已经打开了',2,100,100);

读书人网 >Web前端

热点推荐