zoukankan      html  css  js  c++  java
  • 简单html弹窗

    css:

    <style type="text/css">
        .moneyrecord {
           display:none;
           border:0.5em solid #00AAEE;
           /*height:30%;*/
           width:40%;
           position:absolute;/*让节点脱离文档流,我的理解就是,从页面上浮出来,不再按照文档其它内容布局*/
           top:24%;/*节点脱离了文档流,如果设置位置需要用top和left,right,bottom定位*/
           left:30%;
           z-index:2;/*个人理解为层级关系,由于这个节点要在顶部显示,所以这个值比其余节点的都大*/
           background: white;
           padding: 0px 5px 5px 5px;
       } 
       .moneyrecordover {
           width: 100%;
           height: 100%;
           opacity:0.8;/*设置背景色透明度,1为完全不透明,IE需要使用filter:alpha(opacity=80);*/
           filter:alpha(opacity=80);
           display: none;
           position:absolute;
           top:0;
           left:0;
           z-index:1;
           background: silver;
       }
    </style>

    js:

      <script type="text/javascript">
         var login = document.getElementById('login');
         var over = document.getElementById('over');
    
         var minput = document.getElementById('minput');
         var mover = document.getElementById('mover');
    
         function show() {
            login.style.display = "block";
            over.style.display = "block";
         }
         function hide() {
            login.style.display = "none";
            over.style.display = "none";
         }
    
         function showinput() {
            minput.style.display = "block";
            mover.style.display = "block";
         }
         function hideinput() {
            minput.style.display = "none";
            mover.style.display = "none";
         }
     </script>

    html:

       <div class="moneyrecord" id="login">
           <a class="button" style="padding: 0px 0px 0px 0px;float: right;" href="javascript:hide()">关闭</a>
           <div style="padding-left: 5%;">      
              弹窗内容1
           </div>
       </div>
       <div class="moneyrecordover" id="over"></div>
    
       <div class="moneyrecord" id="minput">
         <a class="button" style="padding: 0px 0px 0px 0px;float: right;" href="javascript:hideinput()">关闭</a>
         <div style="padding-left: 5%;">
         弹窗内容2
         </div>
        </div> 
       <div class="moneyrecordover" id="mover"></div>
  • 相关阅读:
    python format() 函数
    -bash: fork: Cannot allocate memory 问题的处理
    阿里云telnet 3306端口失败
    npm install报错 npm ERR! enoent ENOENT: no such file or directory
    springboot启动后总是自己shutdown
    thymeleaf给bootstrap自定义变量赋值
    java通过反射拷贝两个对象的同名同类型变量
    使用awk按照行数切割文件
    Iterable接口
    mac brew update 报错
  • 原文地址:https://www.cnblogs.com/007sx/p/6213401.html
Copyright © 2011-2022 走看看