CSS+JS实现遮罩层弹框
2018-02-27 16:33
274 查看
具体实现代码
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>CSS弹出遮罩层</title> <style type="text/css"> * { margin:0px; padding:0px; } .zhezhao { width:100%; height:100%; background-color:#000; filter:alpha(opacity=50); -moz-opacity:0.5; opacity:0.5; position:absolute; left:0px; top:0px; display:none; z-index:1000; } .login { width:280px; height:180px; line-height: 180px; text-align: center; position:absolute; top:200px; left:50%; background-color:#808080; margin-left:-140px; display:none; z-index:1500; } .content { margin-top:50px; color:red; line-height:200px; height:200px; text-align:center; } </style> <script type="text/javascript"> window.onload=function() { var zhezhao=document.getElementById("zhezhao"); var login=document.getElementById("login"); var bt=document.getElementById("bt"); var btclose=document.getElementById("btclose"); bt.onclick=function() { zhezhao.style.display="block"; login.style.display="block"; } btclose.onclick=function() { zhezhao.style.display="none"; login.style.display="none"; } } </script> </head> <body> <div class="zhezhao" id="zhezhao"></div> <div class="login" id="login"><button id="btclose">点击关闭遮罩层和提示框 </button></div> <div class="content">内容区域<button id="bt">点击打开遮罩层和提示框</button></div> </body> </html>
相关文章推荐
- js+html5实现半透明遮罩层弹框效果
- JS+CSS简单实现DIV遮罩层显示隐藏
- 使用CSS+JavaScript或纯js实现半透明遮罩效果的实例分享
- js css 实现遮罩层覆盖其他页面元素附图
- JS+CSS简单实现DIV遮罩层显示隐藏
- JS+CSS简单实现DIV遮罩层显示隐藏
- JS+CSS简单实现DIV遮罩层显示隐藏
- css、js两种方法实现遮罩效果
- JS+CSS简单实现DIV遮罩层显示隐藏
- .net MVC框架下利用css+js实现遮罩效果
- css+js实现一个弹出层,完成注册功能 带有遮罩层,比较简单
- .net MVC框架下利用css+js实现遮罩效果
- .net MVC框架下利用css+js实现遮罩效果
- JS+CSS简单实现DIV遮罩层显示隐藏
- js+css实现div遮罩层效果
- .net MVC框架下利用css+js实现遮罩效果
- js+css实现div遮罩层效果
- JS+CSS简单实现DIV遮罩层显示隐藏
- JS+CSS简单实现DIV遮罩层显示隐藏
- JS+CSS简单实现DIV遮罩层显示隐藏