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" onclick="$(\'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;" onclick="javascript:$(\'divDialogBg\').style.display=\'none\';$(\'divDialog\').style.display=\'none\';" onmouseover="this.style.backgroundPosition=\'left -13px\'"onmouseout="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" onclick="$(\'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;" onclick="javascript:$(\'divDialogBg\').style.display=\'none\';$(\'divDialog\').style.display=\'none\';" onmouseover="this.style.backgroundPosition=\'left -13px\'"onmouseout="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;
}

 

posted @ 2010-11-19 17:26  gllg  阅读(212)  评论(0编辑  收藏  举报