首页 > Web开发 > 详细

css+JS实现遮罩弹框

时间:2016-01-06 00:14:58      阅读:208      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>蚂蚁部落</title>
<style type="text/css">
#fade {
display:none;
position:absolute;
top:0%;
left:0%;
width:100%;
height:100%;
background:black;
z-index:1001;
-moz-opacity:0.2;
opacity:0.2;
filter:alpha(opacity=80);
}
#light{
display:none;
position:absolute;
top:25%;
left:25%;
width:50%;
height:50%;
padding:16px;
border:3px solid orange;
background-color:white;
z-index:1002;
overflow:auto;
}
</style>
<script type="text/javascript">
window.onload=function(){
var linkbt=document.getElementById("linkbt");
var light=document.getElementById(‘light‘);
var fade=document.getElementById(‘fade‘);
var closebt=document.getElementById("closebt");
linkbt.onclick=function(){
light.style.display=‘block‘;
fade.style.display=‘block‘;
}
closebt.onclick=function(){
light.style.display=‘none‘;
fade.style.display=‘none‘;
}
}
</script>
</head>
<body>
<a href="javascript:void(0)" id="linkbt"> 点击这里打开窗口</a>
<div id="light">
<a style="float:right;" href="javascript:void(0)" id="closebt">关闭</a>
</div>
<div id="fade""></div>
</body>
</html>

 

css+JS实现遮罩弹框

原文:http://www.cnblogs.com/cxxjohnson/p/5103924.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!