<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>纯CSS和Javascript实现的遮罩层</title>
<style>
#cover
{
background: gray;
position: absolute;
left: 0px;
top: 0px;
display: none;
z-index: 20;
filter: alpha(opacity=60);
opacity: 0.6 !important;
} #close
{
position: absolute;
display: none;
z-index: 21 !important;
}
</style> <script>
function show() {
var cover = document.getElementById("cover");
var close = document.getElementById("close");
cover.style.width = document.documentElement.scrollWidth + "px";
cover.style.height = document.documentElement.scrollHeight + "px";
cover.style.display = "block";
close.style.display = "block";
}
function hide() {
var cover = document.getElementById("cover");
var close = document.getElementById("close");
cover.style.display = "none";
close.style.display = "none";
}
</script>
</head>
<body>
<div id="cover"></div>
<input type="button" name="name" value="显示遮罩层" />
<div id="close">
<input type="button" name="name" value="隐藏遮罩层" />
</div>
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
<br />
纯CSS和Javascript实现的遮罩层
</body>
</html>
|