我思故我强

遮罩层形式的弹出窗口页面


//显示层样例代码
   function callshowmaskExample(popsrcstr){
      //弹出层 赋src
  var popdivframe=document.getElementById('pop_div_tabs_frame');
     if(popdivframe){
       popdivframe.src="<%=request.getContextPath()%>/jsp/homepage/newOASMS.jsp";
       var fade_height= window.document.body.clientHeight;//遮照高度
       var div_height=250;//当前pop 高度,宽度
       var div_width=390;
      // var subframe=document.frames('south2_frame');//隐藏下方select
       showmask(fade_height,div_width,div_height,null,220,460);

     }//if
 }
 //callshowmaskExample("<%=request.getContextPath()%>/jsp/homepage/newOASMS.jsp");




-------------------------------------------------
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>弹出层 begin<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
var subframe;
/*显示层
 *@paraHeight:遮照的高度,默认为首页屏幕高度
 *@div_width:显示的div宽度,默认宽:350
 *@div_height:显示的div高度,默认200
 *@subframeobj:子页面iframe对象
 *@div_top:显示的div的上方高度.2008-10-24加入
 *@div_left:显示的div的左边宽度.2008-10-24加入
 */
function showmask(paraHeight,div_width,div_height,subframeobj,div_top,div_left){
    var t_light=document.getElementById('light');//显示层
    var closeButton=document.getElementById('closeButton');//关闭按钮
 var t_fade=document.getElementById('fade');//遮挡背景
 //var sels = document.getElementsByTagName("select");//当前页面下拉框
 if (paraHeight>t_fade.style.height)  t_fade.style.height=paraHeight;
 if(div_width>350){
  t_light.style.width=div_width;
     t_light.style.height=div_height;
  }
 t_fade.style.display='block';
 t_light.style.display='block';
    closeButton.style.display='block';
    //层定位
    t_light.style.left=(document.body.clientWidth/2) - (t_light.offsetWidth/2);
 t_light.style.top=(document.body.clientHeight/2) - (t_light.offsetHeight/2);

 if(div_top&&div_top!=null)  t_light.style.top=parseInt(div_top);
 if(div_left&&div_left!=null) t_light.style.left=parseInt(div_left);

    closeButton.style.left=parseInt(t_light.style.left)+parseInt(t_light.offsetWidth)-10;
    closeButton.style.top=parseInt(t_light.style.top)-10;
    //增加loading效果,调用page_load.js
    //divAddLoad(parseInt(t_light.style.left)+10,parseInt(t_light.style.top)+10,parseInt(div_width)-20,parseInt(div_height)-20);
    //获取层中iframe
    var pop_div_tabs_frame = document.getElementById("pop_div_tabs_frame");
    pop_div_tabs_frame.style.visibility="hidden";
    //判断iframe状态
    pop_div_tabs_frame.onreadystatechange=function(){fnStartInit(this)};
    //隐藏当前页面下拉框隐藏
    //for(var i=0; i<sels.length; i++){
    //    sels[i].style.visibility = "hidden";
    //}
    //隐藏子页面下拉框
    subframe=subframeobj;
    if(subframe){
        var subselectobj =subframe.document.getElementsByTagName("select");
        for(var i=0; i<subselectobj.length; i++){
               subselectobj[i].style.visibility = "hidden";
         }
     }
}
//iframe状态判断
function   fnStartInit(obj)
  {
    if(obj.readyState == "complete"){
         //  divRemoveLoad();
     obj.style.visibility="visible";
    return;
        }
  }
/*
 *关闭层
 */
function hidemask(){
  document.getElementById('light').style.display='none';
     closeButton.style.display='none';
  document.getElementById('fade').style.display='none';
       if(subframe){
          //将下拉框显示
  var subselectobj = subframe.document.getElementsByTagName("select");
     for(var i=0; i<subselectobj.length; i++){
           subselectobj[i].style.visibility = "visible";
         }
        divRemoveLoad();//去掉遮照
      }
 }
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>弹出层 结束<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

posted on 2008-12-20 14:19 李云泽 阅读(2429) 评论(0)  编辑  收藏 所属分类: javascript


只有注册用户登录后才能发表评论。


网站导航: