function fnShowMessageBox(sTitle, sMsg)弹窗

//弹窗显示
function fnShowMessageBox(sTitle, sMsg)
{
 var h=fnGetWindowHeight();
 var w=fnGetWindowWidth();
 
 if(!$('divDialogBg'))
 {
        var div = $C('div');
        div.id = 'divDialogBg';
        div.style.backgroundColor = 'black';
        div.style.position = 'absolute';
        div.style.filter = 'alpha(opacity=50)';
        div.style.opacity = '.50';
        div.style.zIndex = 100001;
        div.style.left = 0;
        div.style.top = 0;
        div.style.width = w+'px';
        div.style.height= h+'px';
        document.body.appendChild(div);
            
 }
 if(!$('divDialog'))
    {
        var divBox = $C('div');
        divBox.id = 'divDialog';
        divBox.style.left = (w/2 -150)+'px';
        divBox.style.top = (h/2 -60)+'px';
        divBox.style.position = 'absolute';
        divBox.style.zIndex = 100002; 
        divBox.style.width = '300px';
        divBox.style.height= '120px';           
        //var boxHtml = '<div style="background:url(\'/Skins/zh-chs/5.0.0312/Default/Images/ClewBg1.gif\') no-repeat left top;width:280px; height:110px; padding:5px 10px;text-align:left;position:relative;overflow:hidden;"><h3 id="divDialogTitle" style="font-size:14px;font-weight:bold;padding:0 0 0 16px;margin:0 0 3px;height:23px;line-height:23px; background:url(/Skins/zh-chs/Default/Images/CommonArrow1.gif) no-repeat left 5px;"></h3><div style="padding:5px 15px 5px 20px;line-height:150%;text-align:left;" id="divDialogMsg"></div><div style="padding:3px 0; text-align:center;"><input type="image" title="确定" src="/Skins/zh-chs/5.0.0312/Default/Images/TagBtn.gif" οnclick="$(\'divDialogBg\').style.display=\'none\';$(\'divDialog\').style.display=\'none\';" /></div><div style="position:absolute; top:8px; right:8px; cursor:hand; width:13px; height:13px; overflow:hidden;background:url(/Skins/zh-chs/Default/Images/CloseBtn.gif) no-repeat left top;" οnclick="javascript:$(\'divDialogBg\').style.display=\'none\';$(\'divDialog\').style.display=\'none\';" οnmοuseοver="this.style.backgroundPosition=\'left -13px\'"οnmοuseοut="this.style.backgroundPosition=\'left top\'" title="关闭窗口"></div></div>';
        var boxHtml = '<div style="background:url(\'/Skins/'+GlobalConfig.Language+'/5.0.0312/Default/Images/ClewBg1.gif\') no-repeat left top;width:280px; height:110px; padding:5px 10px;text-align:left;position:relative;overflow:hidden;"><h3 id="divDialogTitle" style="font-size:14px;font-weight:bold;padding:0 0 0 16px;margin:0 0 3px;height:23px;line-height:23px; background:url(/Skins/'+GlobalConfig.Language+'/Default/Images/CommonArrow1.gif) no-repeat left 5px;"></h3><div style="padding:5px 15px 5px 20px;line-height:150%;text-align:left;" id="divDialogMsg"></div><div style="padding:3px 0; text-align:center;"><input type="image" title="确定" src="/Skins/'+GlobalConfig.Language+'/5.0.0312/Default/Images/TagBtn.gif" οnclick="$(\'divDialogBg\').style.display=\'none\';$(\'divDialog\').style.display=\'none\';" /></div><div style="position:absolute; top:8px; right:8px; cursor:hand; width:13px; height:13px; overflow:hidden;background:url(/Skins/'+GlobalConfig.Language+'/Default/Images/CloseBtn.gif) no-repeat left top;" οnclick="javascript:$(\'divDialogBg\').style.display=\'none\';$(\'divDialog\').style.display=\'none\';" οnmοuseοver="this.style.backgroundPosition=\'left -13px\'"οnmοuseοut="this.style.backgroundPosition=\'left top\'" title="关闭窗口"></div></div>';
        document.body.appendChild(divBox);         
        setTimeout(function(){divBox.innerHTML = boxHtml;}, 2)
    }
    setTimeout(function(){
        $('divDialogBg').style.display = 'block';
        $('divDialog').style.display = 'block';
        $('divDialogTitle').innerHTML = sTitle;
        $('divDialogMsg').innerHTML = sMsg;
    }, 10); //延时解决IE6下图片有时不能加载的BUG   
}

 

 

///

 

 

function fnGetWindowWidth(){
    var vh = 0;
    var _dEt = document.documentElement;
    var _dBx = document.body;
    if(typeof window.innerWidth=='number')vh = window.innerWidth;
    else{
      if(_dEt&&_dEt.clientWidth)vh = _dEt.clientWidth;
      else{
           if(_dBx&&_dBx.clientWidth)vh = _dBx.clientWidth;
      }
       }
    if(!vh||vh<100)vh =100;
     return vh;
}

function fnGetWindowHeight(){
    var vh = 0;
    var _dEt = document.documentElement;
    var _dBy = document.body;
    if(typeof window.innerHeight=='number')vh = window.innerHeight;
    else{
      if(_dEt&&_dEt.clientHeight)vh = _dEt.clientHeight;
      else{
           if(_dBy&&_dBy.clientHeight)vh = _dBy.clientHeight;
      }
       }
    if(!vh||vh<100)vh =100;
     return vh;
}

 

转载于:https://www.cnblogs.com/gllgsoft/archive/2010/11/19/1882046.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值