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)-->
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。