<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>简单的遮罩层</title>
<style type="text/css">
*{
margin: 0px;padding: 0px;
}
#thisBG{ display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index:1001; -moz-opacity: 0.7; opacity:.70; filter: alpha(opacity=70);}
#showMask{display: none; position: absolute; top: 25%; left: 22%; width: 53%; height: 49%; padding: 8px; background-color: white; z-index:1002; overflow: auto;}
</style>
<script type="text/javascript">
function bthShow(){
//alert(1);
document.getElementById("thisBG").style.display ="block"; //背景显示
document.getElementById("showMask").style.display ="block"; //背景显示
}
function btnclose(){
//alert(1);
document.getElementById("thisBG").style.display ="none"; //隐藏显示
document.getElementById("showMask").style.display ="none"; //隐藏显示
}
</script>
</head>
<body>
<input id="btnShowMe" type="button" value="显示遮罩" οnclick="bthShow();" >
<div id="thisBG" ></div>
<div id="showMask" >
<input id="showMaskbtn" type="button" value="关闭遮罩" οnclick="btnclose();" >
</div>
</body>
</html>
简单的html5的遮罩
最新推荐文章于 2021-03-29 05:33:15 发布