[Next] [TOC] 


This document describes the changes and new features for JavaScript in Navigator 4.0. These features will be included in the new JavaScript Guide at a later date. For additional information about JavaScript, see the "JavaScript Guide."

Feature Summary

Event Model

The event model has changed to include a new event object, new events, and event capturing.



Layers, new in Navigator 4.0, let you define overlapping layers of transparent or solid content in a web page. Each layer in HTML has a corresponding layer object that allows you to use JavaScript to manipulate the layer.

For information on using layers, see "Dynamic HTML in Netscape Communicator." Note that this link takes you to a different set of documents.


Array Methods

Document Method

Navigator Method

String Methods

Window Methods

Shared Methods




Function Property

Navigator Properties

Window Properties

Regular Expressions

Regular expressions are patterns used to match character combinations in strings. In JavaScript, you create a regular expression as an object which has methods used to execute a match against a string. You can also pass the regular expression as arguments to the String methods match, replace, search, and split. A global RegExp object has properties most of which are set when a match is successful, such as lastMatch which specifies the last successful match. Finally, the array object has new properties that provide information about a successful match such as the input which specifies the original input string against which the match was executed.

This section includes:

Signed Scripts

For additional power and functionality, scripts can now gain access to normally restricted information. This is achieved through signed scripts that request expanded privileges. This new functionality provides greater security than tainting.


Style Sheets

Using style sheets, you gain finer control over the presentation of your web pages. Navigator 4.0 supports two syntaxes for designing style sheets: Cascading Style Sheets (CSS) and JavaScript style sheets. CSS is the static approach to specifying style and JavaScript is the programmatic approach.

For information on using style sheets, see "Dynamic HTML in Netscape Communicator." Note that this link takes you to a different set of documents.


Compatibility With Earlier Versions of Navigator

As JavaScript evolves along with Navigator, its capabilities expand greatly. This means that JavaScript written for Navigator 4.0 may work in Navigator 4.0 only. To ensure that users of earlier versions of Navigator avoid problems when viewing pages that use JavaScript 1.2, use the LANGUAGE attribute in the <SCRIPT> tag to indicate which version of Javascript you're using. If you use LANGUAGE="JavaScript1.2", you need to be aware of the equality rules described below.

Statements within a <SCRIPT> tag are ignored if the browser does not have the level of JavaScript support specified in the LANGUAGE attribute; for example:

By using the LANGUAGE attribute, you can write general JavaScript that Navigator version 2.0 and higher recognize, and include additional or refined behavior for newer versions of Navigator.

[Next] [TOC] 

Copyright © 1997 Netscape Communications Corporation