The toString() method, MarqueeString(), uses a table


The toString() method, MarqueeString(), uses a table to center the text vertically and horizontally within the frame.
You should also note that if you use a combination of large and small fonts in your marquee, the text may “wobble” vertically during the transition from one size to another.

The nbsp() function is used to replace all space characters with nonbreaking spaces


The nbsp() function is used to replace all space characters with nonbreaking spaces (&nbsp). This enables you to include consecutive spaces in your text.
It also prevents the scrolling text from breaking into two or more lines when the font is small enough or the marquee window large enough that this would otherwise occur.

In some cases, you may just want to put some text in a frame


In some cases, you may just want to put some text in a frame at a particular time. This isn’t really an effect, per se, but it would be convenient to have an object similar to the rest of our objects for this purpose. The Static object fills this need.
The Static() constructor takes a BodyColor object and a text string, which may contain HTML. You could also use a Text object or a Block object for the text parameter.

The best way to animate images using JavaScript


The best way to animate images using JavaScript is not to. Netscape 2.0 supports GIF89a multipart images, which contain built-in timing and looping instructions. These load faster and run more smoothly than animation created using JavaScript and can be placed anywhere on the page.
A number of inexpensive shareware utilities are available for creating GIF animation, the best-known of which is probably GIF Construction Set by Alchemy Mindworks. While GIF89a images are currently supported only by Netscape, it’s pretty safe to assume that when other browsers support JavaScript, they’ll also support GIF animation.

The url parameter to the Image() constructor must be a fully specified URL


The url parameter to the Image() constructor must be a fully specified URL; relative URLs won’t work within the framework we’ve developed because the default protocol is always assumed to be javascript:. The width and height parameters are required,
But it is not necessarily that they have to be accurate: Netscape automatically scales images to the width and height specified.

Images are not immediately available


Images are not immediately available when we want to put them on the screen-they are usually loaded from a server. And there’s no reliable way of guessing how long that will take.
If you try to display them on a fixed timetable, most likely none of them would get a chance to load completely: the next image you try to display would clobber the one currently loading, and Netscape would start loading it again from scratch the next time it was called for.

The Animator object let each image load completely


The Animator object let each image load completely before displaying the next image by including an onLoad handler in the BODY tag for each image it writes to the screen.
When the Animator object’s toString() method, AnimatorString(), generates a new frame, it sets the ready flag in the object to n, meaning that the Animator is not ready to display a new frame. Once the image has loaded completely, the onLoad handler is called and sets the ready flag back to y.

Loading images from a server has its limitations


Loading images from a server has its limitations. Apart from the amount of time this can take-especially over a slow connection-you generally have a fixed set of images to work with.
There are times when it is useful to create images on-the-fly, perhaps in response to user input or to create a dynamic animation.

We can use single-pixel GIF files to construct images


We can use single-pixel GIF files to construct images. Because Netscape automatically scales images to the specified width and height, you can create rectangles of various dimensions from a 1 ¥ 1 GIF image of a particular color.
This technique is especially useful for creating dynamic bar charts; but beyond that, its applications are very limited. I won’t cover this technique here, but I encourage you to experiment with it on your own.

The greatest drawback to XBM images is that they’re monochromatic


The greatest drawback to XBM images is that they’re monochromatic-in other words, black-and-white, though Netscape renders them as black-and-gray. But this is also something of an advantage to us because they can be represented internally as a string of bits, one per pixel, on or off.
This also makes manipulating them fairly straightforward and not too costly in terms of processor cycles-an important consideration when working with an interpreted language, such as JavaScript. Also important to us, the XBM file’s native format is ASCII text, which can be represented using JavaScript strings.