jquery提示消息。简单通用
function showTips(txt,time,status) { var htmlCon = ''; if(txt != ''){ if(status != 0 && status != undefined){ htmlCon = '<div class="tipsBox" style="220px;padding:10px;background-color:#4AAF33;border-radius:4px;-webkit-border-radius: 4px;-moz-border-radius: 4px;color:#fff;box-shadow:0 0 3px #ddd inset;-webkit-box-shadow: 0 0 3px #ddd inset;text-align:center;position:fixed;top:25%;left:50%;z-index:999999;margin-left:-120px;"><img src="images/ok.png" style="vertical-align: middle;margin-right:5px;" alt="OK,"/>'+txt+'</div>'; }else{ htmlCon = '<div class="tipsBox" style="220px;padding:10px;background-color:#D84C31;border-radius:4px;-webkit-border-radius: 4px;-moz-border-radius: 4px;color:#fff;box-shadow:0 0 3px #ddd inset;-webkit-box-shadow: 0 0 3px #ddd inset;text-align:center;position:fixed;top:25%;left:50%;z-index:999999;margin-left:-120px;"><img src="images/err.png" style="vertical-align: middle;margin-right:5px;" alt="Error,"/>'+txt+'</div>'; } $('body').prepend(htmlCon); if(time == '' || time == undefined){ time = 1500; } setTimeout(function(){ $('.tipsBox').remove(); },time); } }
调用代码
showTips('您的邮箱格式错咯~');
showTips('提交成功~ 即将进入下一步',2500,1);