又一个浮动DIV的例子,今天下午捣鼓出来的,记录一下。
真正起作用的就是一句话,完全兼容浏览器,不管你是拉大还是拉小,不管是IE6,IE7,FF3.都没问题.
document.getElementById('flash1').style.top = (document.body.clientHeight-parseInt(document.getElementById('flash1').style.height)) + document.body.scrollTop + "px";
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Is Page</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css">
* {
margin:0px;
padding:0px;
}
</style>
</head>
<body>
<center>
<div id="www" style="width:1000px;height:3000px;border:1px blue solid;">
</div>
<div id="flash1" style="position:absolute;right:0px;top:auto;width:200px;height:200px;background:red;z-index:99;">
</div>
</center>
<script language="javascript">
function yd()
{
document.getElementById('flash1').style.top = (document.body.clientHeight-parseInt(document.getElementById('flash1').style.height)) + document.body.scrollTop + "px";
}
setInterval("yd()",3);
</script>
</body>
</html>
又一个浮动DIV的例子(轉)
最新推荐文章于 2025-04-16 16:00:07 发布