The introduction of Netscape 6 has worsen the browser-independent scripting situation, at least for the short time. No longer do you have to deal with only two browsers – there are now three major browsers to support. One good old way is to use if
statements. You want to make your script as generic as possible, and use if
clauses as late as possible. The following script uses this technique. The switchEntries()
function is a common event handler for all browsers. The content of switchEntries()
is an if
statement that executes a different statement for every browser:
Al Gore George W. Bush
Click the button below to see how the first option changes on the fly:
Al Gore
George W. Bush
Avoiding Netscape’s Proprietary Features
Netscape 6 does not support the LAYER
and ILAYER
elements. It means that the browser will silently ignore the ,
,
, and
tags. The browser will render the HTML page as if those tags are not present. Any other elements (non-
LAYER
) between and
will be rendered as if the
and
are missing. Obviously, this will change the look of the page. Let’s take an example. The following
LAYER
element includes one line of text:
In Netscape Navigator, this line should be colored tan. Should be white in Netscape 6 and IE.
Here is the rendering of this element on your browser:
In Netscape Navigator, this line should be colored tan. Should be white in Netscape 6 and IE.