html如何实现弹窗 html实现弹窗代码示例
时间:2022-06-25 17:50:49 编辑:袖梨 来源:一聚教程网
html如何实现弹窗?本篇文章小编给大家分享一下html实现弹窗代码示例,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | < meta charset = "utf-8" > < title ></ title > < style type = "text/<a href=" http: = "" www.111com.net = "" cssdiv = "" css.html"="" target = "_blank" >css</ a >"> body{ margin: 0px; } .zhezhao{ position: fixed; left: 0px; top: 0px; background: #000; width: 100%; height: 100%; opacity: 0.5; } .tankuang{ position: relative; background: #fff; width: 50%; height: 80%; border-radius: 5px; margin: 5% auto; } #header{ } #header-right{ position: absolute; border-radius: 5px; background: red; color: #fff; right: 5px; top: 5px; text-align: center; } </ style > < button type = "button" onclick = "dianwo()" >点我</ button > < div class = "zhezhao" id = "zhezhao" style = "display: none;" > < div class = "tankuang" > < div id = "header" > < span >我是弹窗</ span > < div id = "header-right" onclick = "hidder()" >x</ div > </ div > </ div > </ div > < script type = "text/javascript" > document.getElementById('zhezhao').style.display="none"; function dianwo(){ document.getElementById('zhezhao').style.display=""; } function hidder(){ document.getElementById('zhezhao').style.display="none"; } </ script > < script defer = "" src = "https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity = "sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon = "{"rayId":"92a3707bcba98137","version":"2025.3.0","r":1,"serverTiming":{"name":{"cfExtPri":true,"cfL4":true,"cfSpeedBrain":true,"cfCacheStatus":true}},"token":"09a15e901f154c8c900d5950c76ccb92","b":1}" crossorigin = "anonymous" ></ script > |
相关文章
- 《弓箭传说2》新手玩法介绍 01-16
- 《地下城与勇士:起源》断桥烟雨多买多送活动内容一览 01-16
- 《差不多高手》醉拳龙技能特点分享 01-16
- 《鬼谷八荒》毕方尾羽解除限制道具推荐 01-16
- 《地下城与勇士:起源》阿拉德首次迎新春活动内容一览 01-16
- 《差不多高手》情圣技能特点分享 01-16