home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Dynamic HTML: The Definitive Reference, 2rd Ed.Dynamic HTML: The Definitive ReferenceSearch this book

1.8. ECMAScript

When Navigator 2 made its debut, it provided built-in client-side scripting with a new language called JavaScript. Despite what its name might imply, the language was developed at Netscape, originally under the name LiveScript. It was a marketing alliance between Netscape and Sun Microsystems that put the "Java" into the JavaScript name. Yes, there are some striking similarities between the syntax of JavaScript and Java, but those existed even before the name changed.

Internet Explorer 3 introduced client-side scripting for that browser. Microsoft provided language interpreters for two languages: VBScript, with its syntax based on Microsoft's Visual Basic language, and JScript, which, from a compatibility point of view, was virtually 100% compatible with JavaScript in Navigator 2. The name variation had more to do with licensing and corporate politics than it did with programming syntax.

It is important to distinguish a programming language, such as JavaScript, from the document object model that it scripts. It is too easy to forget that document objects are not part of the JavaScript language, but are rather the "things" that programmers script with JavaScript (or VBScript). The JavaScript language is actually more mundane in its scope. It provides the nuts and bolts that are needed for any programming language: data types, variables, control structures, and so on. This is the core JavaScript language.

From the beginning, JavaScript was designed as a general-purpose language that could be applied to any object model, and this has proven useful. Adobe Systems, for example, uses JavaScript as the core scripting language for Acrobat Forms scripting. The same core language you use in HTML documents is applied to a completely different object model in Acrobat Forms.

To head off potentially disastrous incompatibilities between the implementations of core JavaScript in different browsers, several concerned parties (including Netscape and Microsoft) worked with a European computer standards group now known only by its acronym: ECMA. The first published standard, ECMA-262 (http://www.ecma.ch/stand/ecma-262.htm), also known as the politically neutral ECMAScript, is essentially the version of JavaScript found in Navigator 3. A second edition of the standard repaired small errors in the first edition. But the third edition added some new language features that had already been implemented in cross-browser compatible fashion. That version of ECMAScript has essentially been a part of Navigator and IE since the Version 4 browsers. More recent browsers implement features of the core language that will find their way into future versions of the standard. Microsoft and Netscape (the latter by way of the Mozilla group) display a high degree of cross-browser compatibility with respect to the core ECMA-based scripting language.

After the dissonance in the object model arena, it is comforting for web authors to see so much harmony in the core language implementation. For the objects in the core JavaScript language, see Chapter 12.

Library Navigation Links

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