jquery实现遮罩层

<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<link rel="stylesheet" href="css/bootstrap.css" type="text/css">
<style>
	html,body{
		height: 100%;
	}
	#bg{
		z-index: 5;
		position: fixed;
		width:100%;
		height: 100%;
		left:0;
		top:0;
		background-color: rgba(0, 0, 0, 0.7);
		display:none;
	}
	#table{
		z-index: 10;
		position: absolute;
		top: 50px;
		bottom: 50px;
		left: 100px;
		right: 100px;
		background: #fff;
		border-radius:5px;
		overflow:auto;
		display:none;
	}
	#table .tableTitle{
		height: 50px;
		padding: 15px;
		box-sizing: border-box;
		background-color: #f1f2f3;
	}
	#table .tableTitle h4{
		line-height: 0;
	}
	#tableChart{
		height: 420px;
		margin: 20px auto 0;
	}
	#table table.table-floor{
		z-index: 15;
		position: relative;
		width:80%;
		margin:60px auto;
		left:0;
		top:0;
	}
	#table p.closeP{
		float: right;
		font-size: 16px;
		font-weight: bold;
		cursor: pointer;
		margin-top: -20px;
	}
	#table p.closeP>i{
		color: #aaa;
	}
	#table p.closeP>i:hover{
		color:#000;
	}
</style>
<body>
<span οnclick="a(1,2,1,1);">1111111</span>
<div id="bg">

</div>
<div id="table">
	<div class = "tableTitle">
		<h4>这里是标题</h4>
		<p class = "closeP" onclick = "closeP();"><i class = "icon-remove"></i></p>
	</div>

	<div id="tableChart">
	<table class = "table table-bordered table-floor" id = "tableContent">
	</table>
	</div>
</div>
</body>
<script type="text/javascript">
	function a(id,name,total,num) {
		// body...
		$.ajax({
			type:"POST",
			url:"",
			dataType:"json",
			data:{id:id,name:name,total:total,num:num},
			success:function(){
				alert("成功");
			},
			error:function () {
				var item = [];
				$.each([1,2,3,4,5],function(i){
						var str = "<tr>";
					$.each([1,2,3,4,5],function(j,value){
						str += "<td>" + j + value + "</td>";
					});
						str += "</tr>";
					  //  console.log(str);
					    item.push(str);
				});
				item = item.join("");
			//	console.log(item);
				var item = $(item);
				$("#tableContent").append(item);
			}
		});
		$("#bg").show();
		$("#table").show();
	}
	function closeP() {
		$("#tableContent").empty();
		$("#bg").hide();
		$("#table").hide();
	}

</script>
<script src="js/jquery.min.js"></script>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值