Now let's see another simple scroller. This is a
really simple vertical scroller, but I think it's really
fun. Click here, then press the back button to come back
here: v_scrollerThis is the HTML page:
<html><head><title>test</title>
<SCRIPT language="JavaScript">
<!-- The script begin here...
function scrollto_one() {
x=y=1;
self.scrollTo(x,y);
}
function scrollIt() {setTimeout("realscroll()",
1);}
function realscroll() {
self.scrollTo(x,y);
if (y<7250)
{
scrollIt();
y+=3;
}
}
// End of script -->
</SCRIPT>
<BODY onload="scrollto_one()"bgcolor="#000000"
text="#54ff9f">
<br><br><br><br><br><br><br><br>
<center>
<FORM NAME="myForm">
<INPUT TYPE="button"
VALUE="Go"onClick="scrollIt(document.myForm)">
</FORM>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br>Hello!<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
This is a little
scroller<br><br><br><br><br>Well...<br><br><br><br><br>A
vertical scroller!<br>
And so on... (I didn't put the whole page
here)
</center>
</body>
</html>
How it works...well I have to explain you nothing here.
Just the keyword self. It
refers to the current window. ScrollTo(x,y)
is a built-in Javascript function. It is helpful to
scroll the viewing area of the window (a window or a
frame for example). X is the horizontal coordinate of the
viewing area (in pixels) and Y is the vertical coordinate
of the viewing area (in pixels). Onload="scrollto_one():
well you know this event handler (the event is: load; it
means: while the page is loading)