start page | rating of books | rating of authors | reviews | copyrights

Book HomeWebmaster in a Nutshell, 3rd EditionSearch this book

Chapter 11. JavaScript

Contents:

Versions of JavaScript
Syntax
Client-Side JavaScript
JavaScript API Reference

JavaScript is a lightweight, object-based scripting language. The general-purpose core of the language has been embedded in Netscape Navigator, Microsoft Internet Explorer, and other web browsers and embellished for web programming with the addition of objects that represent the web browser window and its contents. This client-side version of JavaScript allows executable content to be included in web pages. With JavaScript, you can move beyond static HTML to write web pages that include programs that interact with the user, control the browser, and dynamically create HTML content. JavaScript is the most popular scripting language for client-side web development.

This chapter starts with coverage of the core JavaScript language, followed by material on client-side JavaScript, as used in web browsers. The final portion of this chapter is a quick-reference for the core and client-side JavaScript APIs. For complete coverage of JavaScript, we recommend JavaScript: The Definitive Guide, by David Flanagan (O'Reilly).

11.1. Versions of JavaScript

The name JavaScript is owned by Netscape. Microsoft's implementation of the language is officially known as JScript, but very few people actually make a distinction between JavaScript and JScript. Versions of JScript are more or less compatible with the equivalent versions of JavaScript, although JScript skipped a version and went directly from JavaScript 1.0 compatibility to JavaScript 1.2 compatibility.

JavaScript has been standardized by ECMA (the organization formerly known as the European Computer Manufacturers Association) and is on the fast track for standardization by the International Standards Organization (ISO). The relevant standards are ECMA-262 and, when standardized by ISO, ISO-16262. These standards define a language officially known as ECMAScript, which is approximately equivalent to JavaScript 1.1, although not all implementations of JavaScript currently conform to all details of the ECMA standard. The name ECMAScript is universally regarded as ugly and cumbersome and was chosen precisely for this reason: it favors neither Netscape's JavaScript nor Microsoft's JScript.

In this chapter, we universally use the term JavaScript to refer to the scripting language. Where certain functionality is implemented only by either Navigator or Internet Explorer, we've noted that fact. When necessary, we use the term ECMA-262 to refer to the standardized version of the language.

The following table specifies what versions of client-side JavaScript are supported by various versions of Netscape Navigator and Microsoft Internet Explorer:

Version

Navigator

Internet Explorer

2

JavaScript 1.0

 

3

JavaScript 1.1

JavaScript 1.0

4

JavaScript 1.2; not fully ECMA-262 compliant prior to Version 4.5

JavaScript 1.2;EMCA-262 compliant



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.