弹出窗口的兼容实现方法

感兴趣的小伙伴,下面一起跟随编程之家 jb51.cc的小编来看看吧。
CSS代码如下:

  html,body {
    margin: 0;
    padding: 0;
  }
  body {
  }
  #div1 {
    height: 2000px;
  }
  #floatedLayer {
    position: fixed;
    _position: absolute;
  }

/***  来自编程之家 jb51.cc (jb51.cc)***/
HTML代码如下:

  <div id=floatedLayer>
    <iframe src=demo.html width=580 height=542 frameborder=no></iframe>
  </div>
  <div id=div1></div>
  <script type=text/javascript>
    var floatedLayer = document.getElementById(floatedLayer);
    function adjustPopupWin() {
      var height = document.documentElement.clientHeight,        width = document.documentElement.clientWidth;       
      floatedLayer.style.left = Math.max((width - floatedLayer.offsetWidth) / 2,0) + px;
      floatedLayer.style.top = Math.max((height - floatedLayer.offsetHeight) / 2,0) + px;
    }
  </script>
  <!--[if IE 6]>
  <script type=text/javascript>
    function adjustPopupWin() {
      var height = document.documentElement.clientHeight,        width = document.documentElement.clientWidth;
      floatedLayer.style.left = Math.max((width - floatedLayer.offsetWidth) / 2,0) + document.documentElement.scrollLeft + px;
      floatedLayer.style.top = Math.max((height - floatedLayer.offsetHeight) / 2,0) + document.documentElement.scrollTop + px;
    }
    window.onscroll = adjustPopupWin;
  </script>
  <![endif]-->
  <script type=text/javascript>
    window.onresize = adjustPopupWin;
    adjustPopupWin();
  </script>
</body>
</html>
<!--   来自 编程之家 jb51.cc (jb51.cc)-->

相关文章

Mip是什么意思以及作用有哪些
怎么测试Mip页面运行情况
MIP安装的具体步骤有哪些
HTML添加超链接、锚点的方法及作用详解(附视频)
MIP的规则有哪些
Mip轮播图组件中的重要属性讲解