Forcing Scrolling to Stay at the Page Top : Browser Scroll « Window Browser « JavaScript DHTML






Forcing Scrolling to Stay at the Page Top

<HTML>
<HEAD>
<TITLE>onScroll Event Handler</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function scrollBack() {
    window.scroll(0,0)
}
function init() {
    document.body.onscroll = scroll;
}
</SCRIPT>
</HEAD>
<BODY onLoad="init()">
<H1>onScroll Event Handler</H1>
<HR>
  This page always zips back to the top if you try to scroll it.
<P>
<IFRAME FRAMEBORDER=0 SCROLLING="no" HEIGHT=1000 SRC="http://www.java2s.com"></IFRAME>
</P>
</BODY>
</HTML>

           
       








Related examples in the same category

1.Scroll the window to a specified position
2.Viewing the scrollLeft and scrollTop Properties