美文网首页
页面遮罩

页面遮罩

作者: lyn0130 | 来源:发表于2016-02-29 15:03 被阅读29次

<pre>
<html>
<head>
<title>遮罩</title>
<script type="text/javascript">
window.onload = function () {
document.getElementById("divshow").style.display = "none";
}
function btnclick() {
document.getElementById("divshow").style.display = "block";
}
</script>
<style type="text/css">
body
{
margin:0px;
padding:0px;
}

divshow

{
position: fixed; /相对于浏览器窗口进行定位/
position:absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
/
透明度*/
display:none;
z-index:999;
}

bg

{
width:100%;
height:100%;
background:#000;
opacity:0.5;
filter:alpha(opacity=50);
position:absolute;
left:0px;
top:0px;
z-index:1;
}
</style>
</head>
<body>
<input type="button" id="btnShow" onclick="btnclick()" value="显示遮罩" />
<div id="divshow">
<div id="bg" ></div>
</div>
</body>
</html>
</pre>

相关文章

网友评论

      本文标题:页面遮罩

      本文链接:https://www.haomeiwen.com/subject/uiegkttx.html