鱼C论坛

 找回密码
 立即注册
查看: 3307|回复: 1

[学习笔记] HTML 模态窗体演示案例

[复制链接]
发表于 2021-7-5 15:23:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <title>模态窗体演示案例</title>
    <style>
        #father {
            background: pink;
            height: 100%;
            width: 100%;
            position: absolute;
        }
        
        #child {
            display: none;
            height: 300px;
            width: 500px;
            margin-top: 10%;
            margin-left: 35%;
            position: absolute;
        }
        
        #son {
            background: white;
            height: 180px;
            width: 430px;
            margin-top: 60px;
            margin-left: 1px;
            position: absolute;
        }
        
        #link {
            display: block;
            font-size: 20px;
            height: 50px;
            width: 50px;
            border-radius: 50%;
            margin-top: 30px;
            margin-left: 431px;
            line-height: 50px;
            text-decoration: none;
            background: white;
            text-align: center;
            position: absolute;
        }
        
        #begin {
            margin-top: 100px;
            text-align: center;
            display: block;
        }
    </style>
</head>

<body>
    <div id="father">
        <div id="begin">
            <a id="begina" href="#">点击开始测试</a>
        </div>
        <div id="child">
            <a id="link" href="#">离开</a>
            <div id="son">

            </div>
        </div>
    </div>
    <script>
        var sc = document.querySelector("#child")
        var ba = document.querySelector("#begina")
        ba.addEventListener("click", function() {
            begin.style.display = 'none';
            sc.style.display = "block";
        })
        var lk = document.querySelector("#link")
        lk.addEventListener("click", function() {
            begin.style.display = 'block';
            sc.style.display = "none";
        })
    </script>
</body>

</html>
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-7-5 15:25:32 | 显示全部楼层
VSCODE  右键直接运行html文档  需加载插件:OPEN IN BROWSER
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-6-19 08:05

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表