蒙板 模态对话框_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 11:27:59
原创
1279人浏览过

 1 <!DOCTYPE html> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5     <title></title> 6     <style> 7         #maskBackground { position: absolute; left: 0px; top: 0px; opacity: 0.2; background-color: red; display: none; z-index: 99; } 8         /*蒙板*/ 9         #maskTip { position: absolute; border: 1px solid blue; background-color: white; z-index: 100; display: none; }10     </style>11     <script>12 13         function ShowMask() {14             //让背景蒙板显示,而且在填满整个浏览器15             var masBg = document.getElementById('maskBackground');16             masBg.style.display = 'block';17             masBg.style.width = window.innerWidth + 'px';18             masBg.style.height = window.innerHeight + 'px';19             //让前景蒙板显示,而且在浏览器的中间20             var maskTip = document.getElementById('maskTip');21 22             //要更改的地方 宽度高度23             maskTip.style.width = '100px';24             maskTip.style.height = '100px';25 26             maskTip.style.left = (window.innerWidth - parseInt(maskTip.style.width)) / 2 + 'px';27             maskTip.style.top = (window.innerHeight - parseInt(maskTip.style.height)) / 2 + 'px';28             maskTip.style.display = 'block';29             30         }31 32         function HideMask() {33             document.getElementById('maskBackground').style.display = 'none';34             document.getElementById('maskTip').style.display = 'none';35         }36 37     </script>38 </head>39 <body>40     <input type="button" id="btnShow" value="显示蒙板" onclick="ShowMask()" />41     <div id="maskBackground"></div>42     <div id="maskTip">43         <input type="button" id="btnHide" value="关闭蒙板" onclick="HideMask()" />44     </div>45 </body>46 </html>
登录后复制

 

AiPPT模板广场
AiPPT模板广场

AiPPT模板广场-PPT模板-word文档模板-excel表格模板

AiPPT模板广场 147
查看详情 AiPPT模板广场

HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号