做一个自适应大小的弹框,子页面不关父页面不能操作

弹框的方法:
function tankuang(){

window.showModalDialog(“bb.html”,”“,’center: Yes; resizable: Yes; status: no; scroll: No’);

   }

弹框页面bb.html:

<html>
  <head>
    <title>bb.html</title>

    <script type="text/javascript">

    function aaa(){    

      window.dialogTop   = (screen.height-document.getElementById("div1").offsetHeight)/2+"px";
      window.dialogLeft  = (screen.width-document.getElementById("div1").offsetWidth)/2+"px";
      window.dialogWidth = document.getElementById("div1").offsetWidth+"px";
      window.dialogHeight = document.getElementById("div1").offsetHeight+"px";
    }

    </script>

  </head>

  <body onload="aaa()">
   <div id="div1" style="width: auto;height: auto;border: 1px red solid;float: left;padding: 20px">
         内容存放位置<br>
      </div>
  </body>
</html>

window.showModalDialog和window.open的区别:

前者是阻塞式模态窗口,只有把弹框关闭后才能操作父页面,后者是非阻塞式,子页面不关闭可以直接操作父页面

onload ()和ready()的区别:
ready 事件的触发,表示文档结构已经加载完成(不包含图片等非文字媒体文件)。
onload 事件的触发,表示页面包含图片等文件在内的所有元素都加载完成。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值