zoukankan      html  css  js  c++  java
  • 动态层显示信息

    动态层显示信息

    <script type="text/javascript">
    /**
     * @author zxub 2006-06-01
     * 状态信息显示类,用var Status=new function()定义,可以静态引用其中的方法
     * 一般情况下为function Status(),这样不能静态引用其中的方法,需要通过对象来引用
     */
    var Status=new function()
    {
        this.statusDiv=null;
       
        /**
         * 初始化状态显示层
         */
     this.init=function()
     {
         if (this.statusDiv!=null)
         {
             return;
         }
      var body = document.getElementsByTagName("body")[0];
      var div = document.createElement("div");
      div.style.position = "absolute";
      div.style.top = "50%";
      div.style.left = "50%";
      div.style.width = "280px";
      div.style.margin = "-50px 0 0 -100px";  
      div.style.padding = "15px";
      div.style.backgroundColor = "#353555";
      div.style.border = "1px solid #CFCFFF";
      div.style.color = "#CFCFFF";
      div.style.fontSize = "14px";
      div.style.textAlign = "center";
      div.id = "status";
      body.appendChild(div);
      div.style.display="none";
      this.statusDiv=document.getElementById("status");
     }
     
     /**
      * 设置状态信息
      * @param _message:要显示的信息
      */ 
     this.showInfo=function(_message)
     {  
         if (this.statusDiv==null)
         {
             this.init();
         } 
         this.setStatusShow(true);
         this.statusDiv.innerHTML = _message;    
     }
     
     /**
      * 设置状态层是否显示
      * @param _show:boolean值,true为显示,false为不显示
      */
     this.setStatusShow=function(_show)
     {  
         if (this.statusDiv==null)
         {
             this.init();
         }
         if (_show)
         {
             this.statusDiv.style.display="";
         }
         else
         {
             this.statusDiv.innerHTML="";
             this.statusDiv.style.display="none";
         }
     }
    }
    </script>
    <input type="button" onclick="Status.showInfo('hellwo world')" value="test">
    <input type="button" onclick="Status.setStatusShow(false)" value="test">

  • 相关阅读:
    COGS 14. [网络流24题] 搭配飞行员
    洛谷 P3376 【模板】网络最大流
    洛谷 P2936 [USACO09JAN]全流Total Flow
    codevs 2038 香甜的黄油 USACO
    codevs 1993 草地排水 USACO
    Openjudge 2.5 6264:走出迷宫
    洛谷 P1744 采购特价商品
    HDU
    中国剩余定理
    bzoj2157: 旅游
  • 原文地址:https://www.cnblogs.com/bestsaler/p/1835569.html
Copyright © 2011-2022 走看看