为什么我的onscroll只执行一次

pegasus827 2011-06-09 11:04:29
自制浮动广告

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
#threenine {
position:absolute;
width:140px;
height:300px;
z-index:1;
}
#threenine1 {
position:absolute;
width:140px;
height:300px;
z-index:2;
}
-->
</style>
<script language="javascript" type="text/javascript">   
<!--   
var advInitTop=300;//层距离顶端的初始值   
function move()  
 {   window.document.getElementById("threenine1").style.top=advInitTop+window.document.body.scrollTop;
window.document.getElementById("threenine").style.top=advInitTop+window.document.body.scrollTop;
  }  
 window.onscroll=move;//窗口的滚动事件,当页面滚动时调用move()函数   //-->  
</script>
</head>

<body>

<table width="910" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="140" valign="top"><div id="threenine1">
<div align="center"><img src="images/ad1.gif" width="80" height="300" />
</div>
</div></td>
<td height="600" bgcolor="#0099CC"><p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p></td>
<td width="140" align="left" valign="top"><div id="threenine">
<div align="center"><img src="images/ad2.gif" width="80" height="300" /></div>
</div></td>
</tr>
</table>
</body>
</html>


结果只执行一次onscroll,然后再滚也不发生移动了??
...全文
345 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
燥动的心 2011-06-09
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 kk297173176 的回复:]

可以呀
[/Quote]
我的FF,IE8,Chrome都可以.
zell419 2011-06-09
  • 打赏
  • 举报
回复
document.body.scrollTop => document.documentElement.scrollTop
试试 。
你的onscroll没有只执行1次 。
kk297173176 2011-06-09
  • 打赏
  • 举报
回复
可以呀
yikeshu520 2011-06-09
  • 打赏
  • 举报
回复
没错啊。

87,919

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧