<!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" onclick="show()" name="name" value="顯示遮罩層" />
<div id="close">
<input type="button" onclick="hide()" 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>