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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.