前端技术(1) : alertII进阶版

需引入 jQuery, 下载 jquery-1.11.3.min.js



html 


<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="../jquery-1.11.3.min.js" ></script>
		<link rel="stylesheet" href="alertII.css" />
		<script type="text/javascript" src="alertII.js" ></script>
	</head>

	<body>
		<button class='collect-btn'>提示</button>
		<div class='dp-model-alert'>
			<div class='content-alert'>
				<div class='content-top-alert'>
					<span class='left-alert span-alert'>温馨提示</span> <span class='right-close-alert span-alert' οnclick="alertII_hide()">✖</span>
				</div>
				<div class='content-bottom-alert'>
					<div class='content-bottom-c-alert'>
						<i class="i-alert"></i> <span class='text-content1-alert span-alert' id="msg_t"></span>
					</div>
					<a class="a-alert" href="javascript:;">
						<div class='content-btn-alert' οnclick="alertII_hide()">确定</div>
					</a>
				</div>
			</div>
		</div>
	</body>
	<script>
		$(".collect-btn").click(function(){
			alertII('请输入用户名!');
		})
	</script>
</html>



css


.i_class-alert {
				width: 30px;
				height: 30px;
				display: inline-block;
				margin-top: -5px;
				background: url(http://hbkj-pc-web-img.oss-cn-beijing.aliyuncs.com/pru_bb_icon.png) -6px -7px no-repeat;
				vertical-align: middle;
			}
			
			.dp-model-alert {
				width: 100%;
				height: 100%;
				position: absolute;
				left: 0;
				top: 0;
				z-index: 9999;
				display: none;
			}
			
			.content-alert {
				width: 450px;
				height: 150px;
				background: #fff;
				position: fixed;
				top: 50%;
				left: 45%;
				margin-left: -75px;
				margin-top: -320px;
				border: 5px solid #ccc;
			}
			
			.content-top-alert {
				height: 30px;
				background: #f8f8f8;
				padding: 0 7px;
			}
			
			.left-alert {
				line-height: 30px;
				float: left;
			}
			
			.right-close-alert {
				float: right;
				line-height: 30px;
				cursor: pointer;
			}
			
			.content-bottom-alert {
				height: 120px;
				position: relative;
			}
			
			.content-bottom-c-alert {
				width: 270px;
				height: 40px;
				position: absolute;
				top: 30%;
				left: 5%;
			}
			
			.i-alert {
				width: 37px;
				height: 40px;
				display: inline-block;
				margin-top: -5px;
				background: url(http://hbkj-pc-web-img.oss-cn-beijing.aliyuncs.com/pru_bb_icon.png) -38px 0px no-repeat;
				vertical-align: middle;
			}
			
			.span-alert {
				line-height: 40px;
				margin-left: 10px;
				font-size: 16px;
			}
			
			.content-btn-alert {
				width: 125px;
				height: 40px;
				background: #02DF82;
				position: absolute;
				top: 30%;
				right: 5%;
				color: #fff;
				line-height: 40px;
				text-align: center;
				cursor: pointer;
			}
			
			.a-alert {
				text-decoration: none;
				color: #fff;
				font-size: 12px;
			}




javaScript



function alertII(msg) {
	var divA = document.getElementById("msg_t");
	divA.innerHTML = msg;
	$('.dp-model-alert').show();
};

function alertII_hide() {
	$('.dp-model-alert').hide();
};





效果图






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值