The News Scroller

The scroller looks like Figure 23-1.

Figure 23-1. The news scroller as it begins

The scroller works by setting a strict clipping box around a layer, then moving that layer up in increments. We only need one function for this, and we keep calling it over and over.

Let's look at the HTML of the page, which is found in Example 23-1, and then we'll look at the script.

Example 23-1. The HTML
<html>
<head>
<title>news scoller</title>
</head>
<body onLoad="scrollnews(0)">

<div id="news" style="position: absolute;visibility:hidden;top:1;left:1;height:600;
 cliprect(10,100,100,10); border-width:0px;"> <table border=0 cellpadding=1 cellspacing=0 ...

Get Advanced JavaScript™: Insights and Innovative Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.