[Contents] [Previous] [Next] [Last]

Introduction

This document describes the changes and new features for JavaScript in Navigator 4.0. For additional information about JavaScript, see the JavaScript section of the DevEdge library.

In addition to the information in this document, DevEdge contains other articles and tutorials explaining the use of some of the new features of JavaScript 1.2. For example, visit View Source, Netscape's online technical magazine for developers, or JavaScript Developer Central, a centralized location for much information about JavaScript, including sample code, tech notes, and other articles.

Feature Summary

Event Model

The event model, as described in Chapter 1, "Event Model," has changed to include a new event object, new events, and event capturing.

Functions

Layers

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.

Methods

Array Methods

Document Method

Navigator Method

String Methods

Window Methods

Shared Methods

Objects

Operators

Properties

Anchor and Link Property

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. The RegExp construction 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 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 data tainting. Data tainting has been removed from JavaScript 1.2.

Statements

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.

Miscellaneous

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.


[Contents] [Previous] [Next] [Last]

Last Updated: 10/22/97 11:47:58


Copyright 1997 Netscape Communications Corporation