JavaScript Rollovers: Compatibility Issues - Doc JavaScript | WebReference

JavaScript Rollovers: Compatibility Issues - Doc JavaScript

Compatibility Issues

As you probably know, not all JavaScript-enabled browsers support the document.images object. In fact, only Navigator 3.0x, 4.0x, and Internet Explorer 4.0x can feature rollovers. The easiest way to make sure the user is running a browser that supports the document.images object is to use a conditional statement:

if (document.images) {

This statement determines whether or not the document.images object exists. If the object does not exist document.images is null, so it evaluates to false when used in a conditional statement. On the contrary, if an object is not null, it evaluates to true in a conditional statement. In Column 6, Browser Compatibility, we discuss object detection in detail.

You must be sure not to deal with document.images or the Image object unless document.images (or window.Image) exists. If you want to execute a function's statements provided that document.images is supported, you may:

Created: August 21, 1997
Revised: March 30, 1998