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

Chapter 12. JavaScript Core Language Reference

Contents:

Internet Explorer JScript Versions
About Static Objects
Mozilla Get and Set Methods
ECMAScript Reserved Keywords
Core Objects
Operators
Control Statements
Miscellaneous Statements
Special (Escaped) String Characters

The previous chapters in the reference part of the book have covered every aspect of Dynamic HTML authoring that affects elements, objects, and styles—the pieces that are often visible on the page. The one part yet to be covered is the scripting glue that makes it possible to access and control the items detailed up to this point—the "D" of DHTML. This chapter covers the core scripting language features that apply to cross-browser application development. This means that VBScript, ActiveX controls, and Java classes accessible through LiveConnect are intentionally omitted here in favor of the core language that is widely deployed in every scriptable browser.

As described in Chapter 1, the JavaScript language was a Netscape invention. Microsoft's version of the language is called JScript. But a browser-neutral version of the language has been approved as a common denominator standard for all JavaScript-derived languages: ECMAScript. There is a great deal of agreement in the implementation of the core elements of this scripting language among browser makers and the ECMA standards group. The biggest challenge for writing core language code (i.e., code that is independent of the scriptable document object model) is knowing what version of the language is supported by which versions of the browser. In the entries for this chapter, you can see at a glance which browser version first supported every core language object, property, method, function, operator, and control statement.

12.1. Internet Explorer JScript Versions

For Internet Explorer for Windows, Microsoft separates the core language functionality from the browser itself by implementing each language as a .dll file that (in some cases) can be updated and swapped in without a change in the browser version. A user visiting a site with the first generation of scriptable browser, IE 3, could have one of two Jscript.dll files installed (Version 1 or 2), depending on Service Pack installation and other variables beyond the control of the page author. This numbering system had no correlation with the JavaScript language version system.

JScript.dll versions continued to progress so that different (and more powerful) versions came installed on each succeeding IE version. Except for Internet Explorer 3, which predates DHTML-capable browsers, the JScript engine version is of no more consequence than the browser version. Therefore, in the listings within this chapter, the versions shown for IE are the first browser versions that are guaranteed to have implemented the particular language item. For example, although the Array object made its debut in JScript.dll Version 2 (during the lifespan of IE 3), it is listed as starting in IE 4.

Object detection techniques, of course, obviate the need for browser or script engine version concerns. The same goes for the official JavaScript versioning; that numbering system (1.0, 1.1, etc.) is likewise avoided throughout this chapter.



Library Navigation Links

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