<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head><body>
<script language="javascript">
<!--
window.onscroll=function()
{
alert("a");
}
//-->
</script>
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
</body></html>

解决方案 »

  1.   

    滚动事件发生触发window.onscroll
      

  2.   

    window.onscroll事件function window_onscroll() {
    /*你要做的事情,有如下相关方法参考
    window.scroll
    window.scrollBy
    window.scrollTo
    */
    } scroll--------------------------------------------------------------------------------DescriptionCauses the window to scroll to the specified x and y offset at the upper-left corner of the window. The preferred method for this is scrollTo; the scroll method is provided for backward compatibility only. Syntax
    object.scroll(x, y)Parameter Description 
    x  (Long) Horizontal position, in pixels. 
    y  (Long) Vertical offset, in pixels. Return ValueNo return value. 
    scrollBy--------------------------------------------------------------------------------DescriptionCauses the window to scroll relative to the current scrolled position by the specified x and y pixel offsets. Syntax
    object.scrollBy(x, y)Parameter Description 
    x (Long) Horizontal scroll offset, in pixels.  
    y (Long) Vertical scroll offset, in pixels.  Return ValueNo return value. ResPositive values of x/y scroll further right/down; negative values scroll further left/up. Setting the scroll position beyond the limits results in the extreme valid scroll position in the direction specified. scrollTo--------------------------------------------------------------------------------DescriptionScrolls the window to the specified x and y offsets at the upper-left corner of the window. Syntax
    object.scrollTo(x, y)Parameter Description 
    x (Long) Horizontal scroll offset, in pixels.  
    y (Long) Vertical scroll offset, in pixels.  Return ValueNo return value.