zoukankan      html  css  js  c++  java
  • js效果我的对话框实现

        对话框是网页中常用的显示信息的工具,所以我自己实现了一个小的对话框。
    dialog = {
        createDialog:
    function(content, newId){
            mask();
            
    var dialogBox = document.createElement('div');
            dialogBox.innerHTML 
    = content;
            
    if(!ctit.utility.isNull(newId)){
                dialogBox.id 
    = newId;
            }
    else{
                dialogBox.id 
    = "__dialogBox__";
            }

            
    var width = 300;
            
    var height = 500;
            
    var left = parseInt((ctit.utility.getViewWidth() - width)/2 + document.documentElement.scrollLeft);
            
    var top = parseInt((document.documentElement.clientHeight - height)/2 + document.documentElement.scrollTop);
            Element.setStyle(dialogBox, 
    {position:"absolute", zIndex:1010, left: left + "px", top: top + "px", parseInt(width) + "px", height: parseInt(height) + "px"});
            dialogBox.style.backgroundColor 
    = "#fff";
            document.body.appendChild(dialogBox);
            dialog.keepON(dialogBox.id);
            
    return dialogBox;
        }
    ,
        resetWidthHeight:
    function(id, width, height){
            
    var o = $(id);
            o.setStyle(
    {parseInt(width)+"px", height:parseInt(height)+"px"});
        }
    ,
        fixedWH:
    function(id){
            
    var o = $(id);
            
    var width = 333;
            
    var height = 555;
            o.setStyle(
    {parseInt(width)+"px", height:parseInt(height)+"px"});
        }
    ,
        keepON:
    function(id){
            
    var o = $(id);
            
    var width = Element.getWidth(o);
            
    var height = Element.getHeight(o);
            
    var left = parseInt((ctit.utility.getViewWidth() - width)/2 + document.documentElement.scrollLeft);
            
    var top = parseInt((document.documentElement.clientHeight - height)/2 + document.documentElement.scrollTop);
            o.setStyle(
    {left:left+"px", top:top+"px"});
            clearTimeout(dialog.timing);
            dialog.timing 
    = setTimeout("dialog.keepON('" + o.id + "');"300);
        }
    ,
        removeDialog:
    function(id){
            
    var o = $(id);
            clearTimeout(dialog.timing);
            document.body.removeChild(o);
            unMask();
        }

    }
  • 相关阅读:
    linux /usr/bin/ld: cannot find -lxxx
    chm手册显示已取消到该网页的导航
    安装 composer SSL operation failed with code 1
    protoc-gen-php --php_out: protoc-gen-php: Plugin output is unparseable.
    Lamp 安装(CentOS6.6, php-5.4.39, httpd-2.4.12, mysql-5.6.24)
    SUSE Linux Enterprise Server 11 软件源
    vmware 下linux 共享文件夹消失
    thrift 安装历程
    隐藏apache服务器信息
    固定总金额、还款天数、还款次数,计算每日每次的还款金额
  • 原文地址:https://www.cnblogs.com/afxcn/p/902769.html
Copyright © 2011-2022 走看看