158Part IIIDocument Objects (Web design templates) ReferenceA plus sign after a
Monday, September 3rd, 2007158Part IIIDocument Objects ReferenceA plus sign after a browser version number means that the language feature was first imple- mented in the numbered version and continues to be supported in succeeding versions. Aminus sign means that the feature is not supported in that browser. The browsers tested forcompatibility include Internet Explorer for Windows and Macintosh, Netscape Navigator, Mozilla (including all browsers based on the Mozilla engine), and Apple s Safari. I also recom- mend that you print the JavaScript and Browser Objects Quick Reference file shown inAppendix A. The file is on the companion CD-ROM in Adobe Acrobat format. This quick refer- ence clearly shows each object s properties, methods, and event handlers, along with keys tothe browser version in which each language item is supported. You should find the printoutto be valuable as a day-to-day resource. Language Essentials for Experienced ProgrammersIn this section, experienced programmers can read the highlights about the core JavaScriptlanguage in terms that may not make complete sense to those with limited or no scriptingexperience. This section is especially for you if you found the tutorial of Part II rudimentary. Here, then, is the quick tour of the essential issues surrounding the core JavaScript language: .JavaScript is a scripting language.The language is intended for use in an existing hostenvironment(for example, a Web browser) that exposes objects whose properties andbehaviors are controllable via statements written in the language. Scripts executewithin the context of the host environment. The host environment controls what, if any, external environmental objects may be addressed by language statements running inthe host environment. For security and privacy reasons, Web browsers generally affordlittle or no direct access via JavaScript to browser preferences, the operating system, or other programs beyond the scope of the browser. The exception to this rule is thatmodern browsers allow deeper client access (with the user s permission) through trustmechanisms such as signed scripts (Netscape) or trusted ActiveX controls (Microsoft). .JavaScript is object-based.Although JavaScript exhibits many syntactic parallels withthe Java language, JavaScript is not as pervasively object-oriented as Java. The core lan- guage includes several built-in static objects from which working objects are generated. Objects are created via a call to a constructor function for any of the built-in objects plusthe newoperator. For example, the following expression generates a Stringobject andreturns a reference to that object: new String( Hello ); Table 13-1 lists the built-in objects with which scripters come in contact. Table 13-1: JavaScript Built-In ObjectsArray1BooleanDateError2EvalError2Function1MathNumber1Object1RangeError2ReferenceError2RegExp3String1SyntaxError2TypeErro2URIError21Although defined in ECMA Level 1, was first available in NN3 and IE3/J2.2Defined in ECMA Level 3; implemented in Moz1.3Defined in ECMA Level 3; implemented fully in NN4 and IE6.