In the Netscape and MSIE web browsers, the object models are provided as representations of the document, the browser, event capturing mechanisms, and the style sheet. In addition, some implementations model the environs, the operating system, and the file system. Each of these object models interacts with the others and is a way of representing the tangible real-world objects.
Although these are generally arranged in a tree-like structure, there are many short cut references that mean you can refer to the same object in a variety of ways. For example the Netscape JavaPackage object can be referred to with the following properties in a Netscape browser:
Netscape
Packages.netscape
window.Packages.netscape
Each one refers to an identical object but from the script writer's point of view, some time can be saved by using the short cuts. Scripts also appear simpler to read.
However, the downside is that the object model hierarchy becomes confusing unless you know about the short-cuts. These shortcuts provided for 'so-called' convenience may in fact be exactly the opposite if they are only available on one platform. Using them immediately renders your script non-portable.
Prev | Home | Next |
Object literal | Up | Object object |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |