弹出页面

思路:弹出的div层中嵌入一个Iframe
弹出层:

<script type="text/javascript">

function openSelUserDiv() {
  // 弹出层
  var newDiv = document.getElementById("divSelUser");
  newDiv.style.display = "";
  newDiv.style.position = "absolute";
  newDiv.style.zIndex = "9999";
  newDiv.style.width = "500px";
  newDiv.style.height = "428px";
  newDiv.style.top = "10px";
  //newDiv.style.left = (parseInt(document.body.scrollWidth)/2)-(parseInt(newDiv.style.width)/2) + "px"; // 屏幕居中
  newDiv.style.left = "70px"; // 屏幕居中
  newDiv.style.background = "#EFEFEF";
  newDiv.style.border = "1px solid #860001";
  newDiv.style.padding = "5px";
  //newDiv.innerHTML = "新激活图层内容";
  //document.body.appendChild(newDiv);
  // 背景层
  var newMask = document.getElementById("show_main");
  newMask.style.display = "";
  newMask.style.position = "absolute";
  newMask.style.zIndex = "1";
  newMask.style.width = document.body.scrollWidth + "px";
  newMask.style.height = document.body.scrollHeight + "px";
  newMask.style.top = "0px";
  newMask.style.left = "0px";
  newMask.style.background = "#000";
  newMask.style.filter = "alpha(opacity=40)";
  newMask.style.opacity = "0.40";
  //document.body.appendChild(newMask);

//  // 关闭mask和新图层
//  var newA = document.createElement("a");
//  newA.href = "#";
//  newA.innerHTML = "关闭激活层";
//  newA.onclick = function() {
//   document.body.removeChild(docEle(_id));
//   document.body.removeChild(docEle(m));
//   return false;
//  }
//  newDiv.appendChild(newA);
 }
 
 //关闭弹出页面
  function ShowUserCancel()
 {
    selFrame.location.replace("SelectUser.aspx");//刷新弹出页面
   
     var newDiv = document.getElementById("divSelUser");
     newDiv.style.display = "none";
    
     var newMask = document.getElementById("show_main");
     newMask.style.display = "none";
 
 }


</script>

//弹出层的HTML代码:
<div id="divSelUser" runat="server"  style="padding:10px 0; display:none; width:500px; height:428px" >
        <iframe id="selFrame" src="SelectUser.aspx" frameborder="0" width="500px" height="428px" scrolling="no"></iframe>
</div>


//弹出页面部分代码:

function closePage()
    {
        parent.ShowUserCancel();//调用父页JS方法关闭页面
    }

posted on 2009-08-26 11:32  heart-in-sky  阅读(240)  评论(0编辑  收藏  举报