• JavaScript 模态对话框


    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
    .back{
    background-color: rebeccapurple;
    height: 2000px;
    }

    .shade{
    position: fixed;
    top: 0;
    bottom: 0;
    left:0;
    right: 0;
    background-color: coral;
    opacity: 0.4;
    }

    .hide{
    display: none;
    }

    .models{
    position: fixed;
    top: 50%;
    left: 50%;
    margin-left: -100px;
    margin-top: -100px;
    height: 200px;
    200px;
    background-color: gold;

    }
    </style>
    </head>
    <body>
    <div class="back">
    <input id="ID1" type="button" value="click" onclick="action1(this)">
    </div>

    <div class="shade hide"></div>
    <div class="models hide">
    <input id="ID2" type="button" value="cancel" onclick="action2(this)">
    </div>

    <script src="jquery-3.1.1.js"></script>
    <script>

    function action1(self) {
    $(self).parent().siblings().removeClass("hide");
    }

    function action2(self) {
    $(self).parent().parent().children(".shade,.models").addClass("hide")
    }
    // function action(act){
    // var ele=document.getElementsByClassName("shade")[0];
    // var ele2=document.getElementsByClassName("models")[0];
    // if(act=="show"){
    // ele.classList.remove("hide");
    // ele2.classList.remove("hide");
    // }else {
    // ele.classList.add("hide");
    // ele2.classList.add("hide");
    // }

    // }
    </script>
    </body>
    </html>

  • 相关阅读:
    CentOS 如何将.deb 文件 转换.rpm
    zabbix 使用SNMP监控富士施乐打印机
    zabbix5.0安装centos7环境
    zabbix5.0安装centos8
    iptables 扩展模式
    -bash: mail: command not found
    笔记本安装Centos8
    Centos 8 安装
    zabbix5.4部署
    死循环判断进程是否存活脚本
  • 原文地址:https://www.cnblogs.com/gerenboke/p/11771841.html
Copyright © 2020-2023  润新知