码迷,mamicode.com
首页 > Web开发 > 详细

js简易美丽的提示框

时间:2017-07-01 12:42:25      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:标示   tip   ext   osi   txt   post   img   error   end   

<span style="font-size:14px;">function showTips(txt, time, status) {
		var htmlCon = ‘‘;
		if (txt != ‘‘) {
			if (status != 0 && status != undefined) {
				htmlCon = ‘<div class="tipsBox" style="width:220px;padding:10px;background-color:#4AAF33;border-radius:4px;-webkit-border-radius: 4px;-moz-border-radius: 4px;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="width:220px;padding:10px;background-color:#F75058;border-radius:4px;-webkit-border-radius: 4px;-moz-border-radius: 4px;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);
		}
<p>	}</span></p><p>/*</p><p>该方法可直接复制使用,
參数:text 字符串 为所提示的信息文字
time 整数 为自己主动消失的时间 单位为毫秒,如:1000
status 整数 1和0 为1时为正确信息提示,背景绿色,图片标示为?符号。为0时。背景红色,标示为?红叉
注:因为图片上传问题。大家能够自行寻找图片16*16</span>

欢迎增加Java交流群:398918539</p><p>*/</p>

js简易美丽的提示框

标签:标示   tip   ext   osi   txt   post   img   error   end   

原文地址:http://www.cnblogs.com/tlnshuju/p/7101866.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!