The crossBrowser() function appears ominous
at first but it is actually quite
amiable. This function serves to bridge the syntactical
gap between DHTML support in Navigator 4 and Internet Explorer
4. Thought of as a translation dictionary of sorts, this
function defines a set of standard variable names, such
as obj, and defines them through their literal
meaning in each browser. So, for example, while one refers
to a layer object in Internet Explorer via the reference
"document.all", one would refer to a layer in
Netscape using "document.layers".
Using this approach, we will simply substitute the term
obj when needing to reference a layer, as you
will soon see, sidestepping the syntax squabble. The key
to this trick will be the JavaScript eval() function.
This function accepts a string parameter and it executes
the value of the string as a
JavaScript statement. For
example, imagine that we've defined a variable named
closeme thusly:
closeme="self.close()";
The following statement, then, would be the functional
equivalent of "self.close()":
eval(closeme);
In any case, the crossBrowser() function simply
defines the translations ... shortly, we'll see them
used in action.