PROGRAMMER TO PROGRAMMER
TM
e-book includes this complete reference and 2000+ extra entries
Build your Web Development career with Wrox
JavaScript Programmer’s Reference
Cliff Wootton
JavaScript Programmer's Reference
Cliff Wootton
Wrox Press Ltd.
JavaScript Programmer's Reference © 2001 Wrox Press
All rights reserved. No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews. The author and publisher have made every effort in the preparation of this book to ensure the accuracy of the information. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, Wrox Press nor its dealers or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book.
Published by Wrox Press Ltd, Arden House, 1102 Warwick Road, Acocks Green, Birmingham, B27 6BH, UK Printed in the United States ISBN 1-861004-59-1
Trademark Acknowledgements Wrox has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Wrox cannot guarantee the accuracy of this information.
Credits Author Cliff Wootton
Technical Editors Timothy Briggs Howard Davies Phillip Jackson Amanda Kay Simon Mackie Chris Mills Peter Morgan
Technical Reviewers Alex Abacus Jonny Axelsson Chong Chang Andrew Van Heusen Martin Honnen Ron Hornbaker Kenneth Lo Jim Macintosh Jon Stephens Peter Torr Chris Ullman Paul Vudmaska Paul Wilton
Project Manager Chandima Nethisinghe
Figures Shabnam Hussain
Production Coordinator Tom Bartlett
Cover Shelley Frazier
Additional Layout Simon Hardware Pippa Wonson
Proofreaders Ian Allen Christopher Smith Agnes Wiggers
Category Manager Dave Galloway
e-Book Production Tom Bartlett Production Manager Simon Hardware
Index Andrew Criddle
About the Author Cliff Wootton lives in the south of England and works on multimedia systems and content management software for large data driven web sites. Currently he is developing interactive TV systems for BBC News Online in London (http://www.bbc.co.uk/news) and previously worked for other commercial broadcasters on their web sites. Before that he spent several years developing geophysical software and drawing maps with computers for oil companies. Cliff is married with three daughters and a growing collection of bass guitars.
Acknowledgements It's hard to believe I've actually reached the stage of writing the introductory pages to this book. It's been a long process and I don't think I would have reached this point without the help of Tim Briggs at Wrox, who very gently urged me onwards and gave me encouragement when I needed it. Tim's contribution to this project was vital to its success because he developed the process which converted my DOCBOOK output into something the Wrox editors could turn into a book. Tim also prepared the CD-ROM content from the same XML files; truly amazing! Thanks also to all the other folks at Wrox who have helped, organised, checked and collated my material to present it in the form you now see it. Grateful thanks to my reviewers, who in a very short time provided me with some useful guidance and support; in particular Jon Stephens and Martin Honnen, who also provided some amazingly clever example code fragments for use as examples. There are many other people who contributed without realising it. In particular Nick Cohen (formerly of the BBC and now at Turner Broadcasting) who provided some helpful insights into TV set-top-box workings. Also Matt Karas and Emyr Tomos (both ex-BBC, now at Talkcast) who threw down the gauntlet of several interesting challenges for me to implement on the BBC News Online web site. I also wouldn't be sitting here if it weren't for Bruce Morris at Carlton Online. It was through the happy chance of an article I wrote for Bruce's Web Developer's Journal (WDJ) web site that led to Wrox contacting me and the BBC inviting me to do some JavaScript work. What an amazing thing the web is. Most importantly I dedicate this book to my family. To my wife, Julie and my daughters Hannah, Lydia and Ruth who kept me going with cups of coffee, hugs and the occasional giggle when they saw the photograph of me for the front cover.
Introduction The JavaScript language is constantly developing, and continues to increase in popularity. Its evolution into a general purpose scripting language from what started life purely for scripting web browsers, is a great success story. You can now find JavaScript interpreters in many different environments and there are sure to be other new and interesting uses for the language in the future, especially now that embeddable interpreters are available. In this book, we have attempted to snapshot the browsers that exist currently, which need to be supported by web sites, and collate that information together in a form that has broad scope and is deep enough to be useful on a day-to-day basis. As the language is growing all the time, this is likely to be an ongoing task.
Who is This Book For? The book is aimed at people who already have some knowledge of JavaScript and need a companion volume to their daily work. It is primarily aimed at the experienced practitioner, and so does not attempt to be a tutorial for the beginner. For a tutorial book, we suggest Paul Wilton's Beginning JavaScript (Wrox Press, ISBN 1-861004-06-0). Typical uses of the book include times when you: ❑
Need to check out the specific details of a particular language construct or object property
❑
Know what you want to do, but want to know how JavaScript helps you achieve that
❑
Want information on cross-browser compatibility issues for your script
❑
Have encountered a problem in your script and need help to debug it
One important motivation I had for writing this book was to reduce the amount of material I have to carry around when I'm working on projects in my clients' offices. My library now contains several shelves devoted purely to JavaScript, and in researching this book, I ended up with many megabytes of material. There have been many fine books written about JavaScript but I simply cannot carry them around on the train, even with a large rucksack! So, I set out to try and distil enough useful information into one book and organize it so that the information is easy to find. I've also put in material on issues that I've encountered in discussions with other programmers.
JavaScript Programmer's Reference
The Structure of the Book To make it easy to navigate through the topics, titles describe the topic content and the topic type and are organized alphabetically. Where a topic might be referred to using several headings, a brief entry in the cross-reference at the end of the book shows the main topic for that subject. I used a great deal of software automation to manage the book content and the whole thing was built in a database and exported as an XML file set using the DocBook DTD. There are now in excess of 3500 individual topics in this work. That is more than twice as many as we have room for in the printed book, so we’ve had to put a useful subset of the reference into the printed book, and the complete set of material onto the CD-ROM, which is available both in PDF and HTML formats. Some additional reference information that is not strictly part of the JavaScript language, but that you may find useful, is also included, such as country codes and MIME types. Where we discuss an object all the important properties, methods, events, and any supporting material are broken out into their own topics, and these detailed entries are included on the CD. Where objects inherit properties and methods, they are listed in the object coverage, but to avoid duplication the information about the inherited properties is described as a member of the super-class. This slightly detracts from the lexical referencing but it saves space. In some cases these inherited properties/methods are deemed important enough to merit a cross-referencing entry of their own. This allows us to indicate availability of features at a very fine level of detail. Within each topic we can also discuss bugs, gotchas, and areas of difficulty in a focused way. Language syntax is illustrated by way of example code fragments that show how to access an object, method, or property. More extensive examples are given where necessary. Because of the scoping rules, properties are available without the need for the window object to be specified as a prefix. Thus navigator as a topic is available under the window.navigator topic as well. Once you have found an entry topic, you can then use the cross-referencing listings to locate other related material. The book content was developed inside a database system, which provided tools to relate topics. The benefit is a rich source of cross-referencing links between topics. The cross-reference in the printed book is complete; that is, it also includes entries found only on the CD. The italicized crossreferences in the printed book can also be found in the printed book. We will now look at some of the 'features' of JavaScript programming, as an introduction to what topics in the book will address.
Differences between Browsers For some time, the most popular browsers have been Netscape Navigator 4.7 and Microsoft Internet Explorer 5.0 (MSIE). Other, newer browsers make a point of being standards compliant and so if your script conforms to the standards for core JavaScript as laid down by ECMA and the W3C DOM specifications, it should function correctly. However, the dominant browsers have for a long time been competing with one another to add new features. Architecturally, this means their browsers have each gone in a completely different direction. The penalty has been that support for various language features has been implemented in each browser in ways that makes it difficult to use in a portable way. Indeed, to make use of some features requires twice the work, since the same code has to be written in two different ways and called after detecting which browser is being used.
2
Introduction
Because of the proliferation of browser versions and platforms, features are generally referred to as being available in the revision in which they were first introduced. As the Netscape browser is available on so many different platforms, to test for compliance across all platforms would require a test suite of a dozen machines and 30 or more different installations of browser applications. Indeed, when building such a test suite just prior to starting on this book, I found more than a dozen distinctly different browser versions just for the Macintosh platform and many more than that for Windows. Similarly, MSIE comes in a bewildering variety of versions and platform variants. In addition, the JScript interpreter is a replaceable component that can be upgraded without changing the containing browser.
Browsers and Standards There is still much that is ambiguous or not yet defined in the standards and the browser manufacturers continue to add new features in competition with one another. Even though they are standards compliant at a functional level, there are still significant differences if you 'look under the hood'. We have included coverage of the following standards: ❑
ECMAScript core language up to edition 3 of the standard
❑
DOM coverage to level 1
❑
Some DOM coverage of level 2 where implemented in Netscape 6
❑
Discussion of the features being added at DOM level 3
JavaScript implementations we cover include: ❑
Netscape 3.0, 4.0, 4.05, 6.0 (the final release came out as we went to press)
❑
MSIE version 3.0, 4.0, 5.0, 5.5
❑
Opera 3, 4, 5
❑
Netscape Enterprise Server
By implication that means we cover JavaScript versions up to 1.5 and JScript up to 5.5. The coverage of Netscape 6.0 is based on it supporting the W3C DOM standards and several bugs in the currently released version prevented the verification of some functionality although that may be platform dependent. There are also some new and unexpected features. We concentrate our discussions on the peculiarities of Netscape and MSIE because the other browsers that support JavaScript attempt to provide a fault-free standards-based implementation. Since this is a sub-set of the functionality of Netscape and MSIE, other platforms should be adequately covered.
Features and Versions There are now a wide variety of sources of information about JavaScript and they don't all agree. In particular there is some uncertainty over which release of JavaScript introduces certain features. The source material was assimilated by examining the standards documents and by inspecting objects with fragments of JavaScript. Then, the availability of features was checked against several alternative reference works. Occasionally, when a consistency error showed up, it was necessary to go back to the browser and test for the availability of a property or method.
3
JavaScript Programmer's Reference
Where there is some room for doubt, we have documented the release at which the feature became useful. This is because in earlier releases it may have had a serious flaw or been significantly revised later to make it work properly. Any implementation prior to that may be unreliable. So where we may appear to disagree with other commentators our coverage is based on whether it is practical to use a particular feature at a certain release. Some browser features are available at an earlier release on some platforms than others are. We take the Windows 32-bit release as our baseline although significant testing was also done on the Macintosh versions, which disappointingly lagged somewhat in performance and feature availability. Both platforms exhibited instabilities and crash-prone behavior but in quite different areas of the language. As there are so many variants of the browsers, the availability matrix for objects and their member properties/methods is huge and requires a large amount of work to test on all the available combinations. So far, no single reference source has proven to be error free and whilst the information here has been examined and cross-checked it is still likely that there are errors. If, in your work, you disagree with the information provided here, please send feedback (see the end of the Introduction for how to do this).
Core JavaScript At first glance, the JavaScript environment appears to be built around a small core of objects and it is easy to fall into the trap of assuming the language is small and compact. That is certainly true if you are only considering core JavaScript functionality. The core language is defined by ECMA and both Netscape and MSIE both claim to be ECMA compliant. They may well be, but you cannot write much useful JavaScript for deployment in a web page by confining yourself only to the functionality of the ECMA standard. It is at that point that the two browsers begin to diverge.
DOM Support Likewise, both browsers (MSIE 5 upwards and Netscape 6) claim to be DOM compliant. Browser support for the DOM is slowly converging but if you need to do any esoteric code development that involves DOM traversal and class names, they are still somewhat different. MSIE implements a DOM model that is structurally right, but the class names of the objects that comprise that model are certainly not correct and do not conform to the DOM standard. Netscape 6 implements a DOM compliant model that does use the correct class names. Another slight difference is that MSIE implements distinctly different classes for some objects whereas Netscape Navigator instantiates the same class for several purposes. These differences don't cause much grief to you when you are constructing simple scripts and web page enhancements but can be quite a problem if you need to manipulate the DOM structure and operate on objects by means of their class names. This difference did not become apparent until I used inspection scripts to examine internal document structures. There are also areas where DOM specifies objects in a way that the browsers can implement ambiguously. For example, DOM describes documents as being a generic document class with an HTML document as a sub-class. Browsers simply provide a single document class with no access to the two separate class types.
4
Introduction
Object Classes You might also assume that there is a small and finite set of different object types. However if you inspect the constructor properties and examine the function names, you will find the opposite, there are a large number of object types. For example, the applets property that returns a list of applets in a document will give you an AppletArray object and not a Collection object in Netscape. Trying to work out class names on MSIE is a bit more problematic and it tends to provide generic Collection objects instead. By building fragments of JavaScript to inspect objects, you can determine these class names and learn a lot about how the browser maintains the internal model of the page. The topics are constructed around a browser-centric model. The objects are defined based on their instantiation by an HTML tag in a web browser window. MSIE creates a distinct object class for each tag. Netscape does a similar trick, but not so convincingly in earlier versions. At version 6, the objects are DOM compliant and named differently to those in MSIE and earlier Netscape browsers. Netcsape 6 is so different as to be a new browser with little similarity to the earlier versions of Netscape. There is an emerging standards-based model that frames the object hierarchy much more logically and, while it is still evolving, it may become a more robust way of describing the catalog of available classes. For now, though, the web and browser dominate use of JavaScript, so this seems like the more appropriate model.
Document Objects Another area of debate is the document object. Typically, the previous documentation describes access to it as if there is only one document object. This is true within the context of a single script within a page. However, it is not necessarily true of a window in a web browser. A window may contain many frames or layers. Each one will have its own private document object. If you are writing scripts that operate across multiple frames or windows, you may refer to several document objects, so the syntax examples are designed to accommodate the different ways in which objects can be accessed.
The Future JavaScript is becoming available in an ever-wider variety of applications. It is used in: ❑
PDF forms for validation
❑
For modifying the behavior of the GUI in developer tools
❑
Embedded interpreters in cell phones and television set-top boxes
There was not space enough or time to cover these extensively. They are also changing continually and will not be stable enough to document for a while yet.
What Do I Need to Use This Book? All that is needed to use this book is a text editor and a JavaScript-enabled browser, such as Microsoft Internet Explorer or Netscape Navigator. To use the CD you will need a browser to read the HTML files and a copy of Adobe Acrobat Reader/Adobe Acrobat eBook Reader to read the PDF files, which are freely available from www.adobe.com. To make navigation easier, the PDF files contain interactive bookmarks, thumbnails, and hyperlinks in the entries. All of the code examples given in the book are available on the CD, and are also available to download from our web site, www.wrox.com.
5
JavaScript Programmer's Reference
Conventions Used in This Book The convention used for syntax naming is that a variable created within the local scope would be prefixed with my while a global variable would be prefixed with the. Parameters passed into function and method calls are prefixed with a, an, or some. The syntax description for an object shows how a reference to an object of that class can be retrieved via a property or method on another object. The syntax for properties and methods show them as members of an object that is referred to with a variable. This manifests itself as an object reference like this: myDocument myDocument myDocument myDocument
= = = =
document myElement.parentNode myFrame.document myLayer.document
Then a property reference looks like this, myDocument.cookie
and not: document.cookie
Of course you can omit the indirection through a referencing variable and any of these would be equally valid: document.cookie myElement.parentNode.cookie myFrame.document.cookie myLayer.document.cookie
But by using the indirection, the syntax descriptions for the member properties and methods are simplified. In the tables, we have used the abbreviations N for Netscape, NES for Netscape Enterprise Server, and IE for Internet Explorer. As for styles in the text:
6
❑
Filenames, and code in the text appear like so: dummy.xml
❑
Test on user interfaces, and URLs, are shown as: File/Save As…
Introduction
Customer Support Wrox has three ways to support books. You can: ❑
Post and check for errata at www.wrox.com
❑
Enroll at the peer-to-peer forums at p2p.wrox.com
❑
Email technical support a query or feedback on our books in general
Errata You can check for errata for the book at our web site; www.wrox.com, simply navigate to the page for this book. There will be a link to the list of errata.
P2P Lists You can enroll in our peer to peer discussion forums at p2p.wrox.com. The JavaScript list is available in the 'Web Design' section.
Email Support If you wish to point out an errata to put up on the website or directly query a problem in the book with an expert who knows the book in detail, then e-mail
[email protected]. A typical email should include the following things: ❑
The name of the book, the last four digits of the ISBN and the entry name for the problem in the Subject field
❑
Your name, contact info and the problem in the body of the message
You may want to tell us your opinion of this book, or you may have ideas about how it can be improved, in which case, e-mail
[email protected]. We will do our utmost to act upon your comments.
7
A A object (Object/HTML) An object that represents an element when instantiated in MSIE. Availability:
JScript – 1.0 Internet Explorer – 3.02
Inherits from:
Element object, Node object
JavaScript syntax:
IE
myA = myDocument.all.anElementID
IE
myA = myDocument.all.tags("A")[anIndex]
IE
myA = myDocument.all[aName]
IE
myA = myDocument.anchors.item(aName)[anIndex]
-
myA = myDocument.anchors[aName]
-
myA = myDocument.anchors[anIndex]
-
myA = myDocument.getElementById(anElementID)
-
myA = myDocument.getElementsByName(aName)[anIndex]
-
myA = myDocument.getElementsByTagName("A")[anIndex]
IE
myA = myDocument.links.item(aName)[anIndex]
-
myA = myDocument.links[aName]
-
myA = myDocument.links[anIndex]
HTML syntax: Argument list:
... anIndex
A reference to an element in a collection
aName
An associative array reference
anElementID
The ID value of an Element object
Object properties: accessKey, dataFld, dataSrc, hash, host, hostname, href, Methods, mimeType, nameProp, pathname, port, protocol, protocolLong, rel, search, tabIndex, target Event handlers:
onBlur, onClick, onDblClick, onFocus, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onSelectStart
See also:
Element object, Input.accessKey, Map object, Anchor object
A – A object (Object/HTML)
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
accessKey dataFld dataSrc hash host hostname href Methods mimeType nameProp pathname port protocol protocolLong rel search tabIndex target
1.5 + -
3.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 3.0 + 1.0 +
6.0 + -
4.0 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 3.02 + 4.0 + 3.02 +
-
1+ 1+ 1+ 1+
-
-
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onBlur onClick onDblClick onFocus onHelp onKeyDown onKeyPress onKeyUp onMouseDown onMouseMove onMouseOut onMouseOver onMouseUp onSelectStart
-
3.0 + 1.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 1.0 + 3.0 + 3.0 +
-
4.0 + 3.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 3.0 + 4.0 + 4.0 +
-
-
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + -
Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning -
9
JavaScript Programmer's Reference
ABBR object (Object/HTML) An object representing the HTML content (an abbreviation) delimited by the HTML tags. Availability:
HTML version – 4.0 JScript – 3.0 Internet Explorer – 4.0
Inherits from:
Element object, Node object
JavaScript syntax:
IE
myABBR = myDocument.all.anElementID
IE
myABBR = myDocument.all.tags("ABBR")[anIndex]
IE
myABBR = myDocument.all[aName]
-
myABBR = myDocument.getElementById(anElementID)
-
myABBR = myDocument.getElementsByName(aName)[anIndex] myABBR = myDocument.getElementsByTagName("ABBR")[anIndex]
HTML syntax: Argument list:
... anIndex
A reference to an element in a collection
aName
An associative array reference
anElementID
10
Event handlers:
The ID value of an Element object onClick, onDblClick, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp
See also:
style.speak, Element object
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick onDblClick onHelp onKeyDown onKeyPress onKeyUp onMouseDown onMouseMove onMouseOut onMouseOver onMouseUp
1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 +
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 +
6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 +
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 +
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 +
-
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 +
Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning
A – about: URL (Request method)
about: URL (Request method) This is a special kind of URL that fetches content from a storage area inside the Netscape browser instead from using HTTP to get it from a web server. Availability:
JavaScript – 1.1 JScript – 3.0 Internet Explorer – 4.0 Netscape – 3.0
This is a special request method provided by the Netscape browser to gain access to local clientside resources. The resources are loaded from inside the application itself. In the Macintosh version of Navigator, this means they are stored in the resource fork of the browser application. If you need to deploy a custom version of Navigator within an intranet environment, with some care you can modify these resources with a resource-editing tool, such as ResEdit. Always work on a copy of the application and test the changes thoroughly. On other platforms, the resources are likely to be stored in files located in folders adjacent to the application. You will need to study your own copy of Netscape to see what you can change. These special URLs are mostly not present in early versions of MSIE, although there will be some internal resources, which may provide customization opportunities. MSIE also supports an about:blank URL that provides a blank page. There may be others hidden away inside the application. You may also be able to obtain administration tools from Netscape and Microsoft to carry out legitimate customizations on the browsers before deploying them throughout your organization. The following special URLs seem to work when typed into the location box: URL
Description
about:logo
Netscape logo
about:mozilla
A fire & brimstone quote from the book of Mozilla (Yes it's really there – at least on some versions)
about:authors
Shows a cryptic message about the page having been removed, although the authors.html file is still present inside the application
about:cache
Displays a disk cache report
about:document
Displays the document info console
about:fonts
Displays the font info console
about:global
A global history report
about:image-cache
A report on the internal image cache
about:license
A hyperlink to the Netscape license document
about:mailintro
Displays the Netscape mail info page
11
JavaScript Programmer's Reference
URL
Description
about:memory-cache
A report on the memory cache
about:pics
Generates a security exception
about:plugins
A page of information about the plugins
about:security?advisor=XXX
Brings up a security console where XXX indicates the window to operate on.
about:security?banner-insecure
Serves an unlocked padlock image
about:security?banner-secure
Serves a locked padlock image
about:security?issuer-logo=XXX
Returns a graphic where XXX identifies which one
about:security?subject-logo=XXX
Returns a graphic where XXX identifies which one
about:coslogo2
Cosmo logo
about:fclogo
Full Circle software logo
about:hslogo
Beatnik logo
about:hype
An audio clip
about:insologo
Inso logo
about:javalogo
Java compatible logo
about:litronic
Litronic logo
about:mclogo
Marimba Castanet logo
about:mmlogo
Macromedia logo
about:ncclogo
Netcast logo
about:odilogo
Object Design logo
about:qtlogo
Apple QuickTime logo
about:rsalogo
RSA secure logo
about:symlogo
Symantec logo
about:tdlogo
TrueDoc logo
about:visilogo
VisiGenic logo
about:blank
Presents a blank page on Netscape Navigator 3 and MSIE version 5; used to create a blank page when a new window is opened
Some of these URLs can be used in frames, but others can't. A few can be used as HREF values. JavaScript complains that the about: request method is illegal. This means you cannot change the location.href within a page to any of the "about:" URLs. However, you might be able to write some innerHTML content into a or <SPAN> to place a link to these assets. Many of the built-in assets are used as image sources in the about page. It's possible you might want to display the Netscape logo. If you are aware that you are using software provided by the other third parties, you might (if they give you permission) place their logo on the screen when you are using features of their software. You should ask first, although Netscape probably won't mind their logo being served like this.
12
A – abstract (Reserved word)
The interesting thing about this is that you are effectively serving assets out of a static cache in the client file system. The URL that points at the license document may be useful as it is possible you might want to display the Netscape license if you are redistributing the browser. The about:plugins URL yields a page containing some useful JavaScript that displays the plugins page. You may find some useful techniques in here for managing plugin facilities although they may be Netscape compatible only. Mostly, these special URLs will be useful for debugging. Getting details of the disk cache, for example, may be useful. Pulling up the JavaScript debugger page if you detect an error in your script might also be a cool trick. The MSIE and Netscape browsers can both use the about:blank URL value as a default page when the browser is started up.
Warnings: ❑
The UniversalBrowserRead privilege is required for access to internal browser values and state information such as the cache contents. See also:
javascript: URL, nethelp: URL, UniversalBrowserAccess, UniversalBrowserRead, URL
abstract (Reserved word) Reserved for future language enhancements.
Refer to: Reserved word
Cross-references: ECMA 262 edition 2 – section – 7.4.3 ECMA 262 edition 3 – section – 7.5.3
AbstractView object (Object/DOM) An object that belongs to the DOM level 2 views module. Availability:
DOM level – 2 JavaScript – 1.5 Netscape – 6.0
JavaScript syntax:
N
myAbstractView = myMouseEvent.view
N
myAbstractView = myUIEvent.view
13
JavaScript Programmer's Reference
This is part of a new suite of functionality introduced at DOM level 2, which provides a way of looking at documents from alternative points of view. At present only the Abstract and Document views are standardized and, because the capabilities are quite new, implementations may be incomplete at this stage. See also:
MouseEvent object, MouseEvent.initMouseEvent(), UIEvent object
Accessor method (Definition) A method for accessing publicly available object properties. Availability:
ECMAScript edition – 2
A method used to store or retrieve property values contained in objects. In ECMAScript-compliant implementations, this is accomplished with internal functions named Get() and Put(). If you add new properties to an object of your own, you may want to implement functions that operate by using the 'this' variable to access properties. These functions are then associated with the object or its prototype, so that they can be shared. They are then referred to as methods rather than functions. See also:
function( ... ) ..., Get(), Method, Put()
Cross-references: ECMA 262 edition 2 – section – 8.6.2 ECMA 262 edition 3 – section – 8.6.2
ACRONYM object (Object/HTML) An object representing the HTML content delimited by the HTML tags. Availability:
JScript – 3.0 Internet Explorer – 4.0
Inherits from:
Element object, Node object
JavaScript syntax:
IE
myACRONYM = myDocument.all.anElementID
IE
myACRONYM = myDocument.all.tags("ACRONYM")[anIndex]
IE
myACRONYM = myDocument.all[aName]
-
myACRONYM = myDocument.getElementById(anElementID)
-
myACRONYM = myDocument.getElementsByName(aName)[anIndex] myACRONYM = myDocument.getElementsByTagName("ACRONYM")[anIndex]
-
14
A – Activation object (Object/internal)
HTML syntax: Argument list:
... anElementID
The ID value of the element required
anIndex
A reference to an element in a collection
aName Event handlers:
An associative array reference onClick, onDblClick, onDragStart, onFilterChange, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onSelectStart
See also:
style.speak, Element object
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick onDblClick onDragStart onFilterChange onHelp onKeyDown onKeyPress onKeyUp onMouseDown onMouseMove onMouseOut onMouseOver onMouseUp onSelectStart
1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + -
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 +
6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + -
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 +
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + -
-
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + -
Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning -
Activation object (Object/internal) The activation object is created when the flow of control first enters an execution context. Availability:
ECMAScript edition – 2
The activation object is created when the flow of control first enters an execution context for declared function code, anonymous code or implementation-supplied code.
15
JavaScript Programmer's Reference
As the activation object is created, it is associated with the execution context. On initialization, it has a property called arguments that cannot be deleted and that refers to an arguments object. This activation object is then used as the variable object for instantiating all the argument variables. The activation object is discarded when the function returns its result to the caller. The activation object is an internal mechanism and so cannot be passed to the outside world, although members of the activation object may well be accessible to a running script. See also:
Execution context, function(…) ...
Cross-references: ECMA 262 edition 2 – section – 10.1.6 ECMA 262 edition 3 – section – 10.1.6
Active Server Pages (Product) A Microsoft web server product. This is a server-side programming framework that supports JavaScript. More accurately, it supports JScript, which is Microsoft's flavor of JavaScript. For more information, see ASP 3.0 Programmer's Reference, ISBN 1-861003-23-4 from Wrox Press. See also:
BODY.recordNumber, Event.bookmarks[], Event.boundElements[], Input.recordNumber, SCRIPT.recordNumber, Server-side JavaScript, TextStream object
ActiveX (Product) This is a Microsoft technology for embedding and sharing code. In MSIE (on Windows), interactions between scripts and applets takes place by means of ActiveX. Microsoft prefers to treat applets as a special kind of ActiveX object. Netscape shows a similar preference towards treating applets as Java components. If you are developing web-based applications for a captive audience who you know will be running MSIE on Windows, then this technology may be appropriate for your project. However, ActiveX is not supported on Netscape and, in fact, is unlikely to be well supported on any other browsers aside from MSIE. Coupling this with the fact that it is not supported outside the Windows platform, you will almost certainly find Java to be a more portable solution. The Java solution is also secured better than ActiveX, which can expose the internals of your system in ways you would rather avoid.
16
A – ActiveXObject object (Object/JScript)
For a high degree of Windows integration and a very Microsoft-oriented solution, ActiveX is ideal. For portability across platforms and browsers, it's likely you'll do much better to select Java. See also:
Applet object, Dictionary object, Glue code, LiveConnect
Web-references: http://msdn.microsoft.com/scripting/
ActiveXObject object (Object/JScript) A Windows and MSIE specific object that allows various document components to be embedded. Availability: JavaScript syntax:
JScript – 3.0 Internet Explorer – 4.0 myActiveX = ActiveXObject IE IE
myActiveX = new ActiveXObject (anApplication)
Argument list:
anApplication
References an external application
Collections:
Depends on the object created by the constructor
This is an object for embedding other applications into web pages on the Windows platform. The example shows the creation of an object that is managed by the Word application. This is also used to create Dictionary objects by using the Scripting application to create a new Dictionary object.
Warnings: ❑
This is totally non-portable and non-standard, but if your scripts are likely to be deployed in a Windows-only environment, it may be useful.
❑
Using this construct in client-side scripting is subject to security restrictions. If a script in a web browser could just instantiate Word, then that implies that it has rights of access to the local file system. The normal IE security settings disallow that level of access.
Example code: // An example that opens a Word document and writes // text into it. var myActiveX = new ActiveXObject("Word.Document"); myActiveX.Application.Visible=true; myString="Some text to be written to the document"; // now write the text to the word document myActiveX.application.selection.typeText(myString);
See also:
Dictionary object, OBJECT object
17
JavaScript Programmer's Reference
ActiveXObject() (Constructor) Used for manufacturing new ActiveX objects. Availability: JavaScript syntax:
Argument list:
JScript – 3.0 Internet Explorer – 4.0 new ActiveXObject(anObjectType) IE IE
new ActiveXObject(anObjectType, aLocation)
anObjectType
What sort of application and object class type to be created
aLocation
A server name where the source object is located
You can use this constructor for creating new objects. You need to specify the kind of object to be created in the string argument value.For example, to create a Microsoft Word document, pass the string "Word.Document" to the constructor. You can also specify a second optional argument to locate the application on a remote server. Here are some example applications you can invoke: ❑
Word.Document – Create an empty Word document
❑
Excel.Sheet – Create an empty Excel spreadsheet
❑
Microsoft.XMLDOM – Create a new XML document
Other alternatives depend on the applications you have installed on your client system. See also:
GetObject()
Add (+) (Operator/additive) Add two numeric operands together. See concatenation for Strings. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
anOperand1 + anOperand2
anOperand1
An expression that evaluates to a number
anOperand2
Another expression that evaluates to a numeric value
Argument list:
18
A – Add (+) (Operator/additive)
The addition operator adds two numeric values together or concatenates one string onto another. When used with numeric operands, the plus sign adds the values together. The addition is commutative, meaning that the order of the operands does not affect the outcome of the calculation. However, the calculation is not always associative (so (a+b)+c is not always the same as a+(b+c)) and so the precedence established with the grouping operator might affect the outcome. The associativity is left to right. Refer to the operator precedence topic for details of execution order. If either operand is NaN, the result will be NaN. The sum of infinity and minus infinity will be NaN; they do not cancel one another out. The sum of two infinity values of the same sign will be the infinity of that sign. The sum of infinity and a finite value is equal to the infinite operand. Internally the sum of two negative zero values is -0. However, the sum of two positive zero value or a positive and negative zero value added together will be +0. At the scripting level however, you cannot determine whether a zero is positive or negative, but its sense may affect subsequent computations. The sum of zero and a non-zero value will be the non-zero value. The sum of two non-zero finite values of the same magnitude but opposite signs will be zero. Provided neither an infinity, a zero nor NaN is involved, adding two finite values results in the sum of the two values given that the result will be rounded to its nearest representable value. Where the result exceeds the largest presentable value, infinity will be substituted. A negative infinity may result from an underflow. The addition/concatenation operator looks at the arguments and if either is a String already or preferentially converts to one, then a concatenation occurs. If neither operator prefers to be a String, then a Number conversion happens and the values are added. See also:
Add then assign (+=), Additive expression, Additive operator, Associativity, Negation operator (-), Operator Precedence, String concatenate (+), Subtract (-), Type conversion, Unary expression, Unary operator
Cross-references: ECMA 262 edition 2 – section – 11.6.1 ECMA 262 edition 2 – section – 11.13 ECMA 262 edition 3 – section – 11.6.1 Wrox Instant JavaScript, ISBN 1-861001-27-4 – page – 37
19
JavaScript Programmer's Reference
Add then assign (+=) (Operator/assignment) Add two numeric operands and assign the result to the first. See concatenation for Strings. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
anOperand1 += anOperand2
anOperand1
An expression that evaluates to a number
anOperand2
Another numeric value
Argument list:
Add the right operand to the left operand and assign the result to the left operand. This is functionally equivalent to the expression: anOperand1 = anOperand1 + anOperand2; Although this is classified as an assignment operator, it is really a compound of an assignment and an additive operator. It also works with string values and will concatenate the second onto the first. The associativity is right to left. Refer to the operator precedence topic for details of execution order. The new value of anOperand1 is returned as a result of the expression.
Warnings: ❑
The operand to the left of the operator must be an LValue. That is, it should be able to take an assignment and store the value.
Example code: // Initialize with numeric valuesmyVar1 = 100;myVar2 = 1000; // After this myVar1 contains 1100, myVar2 is unchanged myVar1 += myVar2;
See also:
20
Add (+), Additive operator, Assign value (=), Assignment expression, Assignment operator, Associativity, Concatenate then assign (+=), Increment value (++), LValue, Operator Precedence, Subtract then assign (-=)
A – Adding JavaScript to HTML (Advice)
Cross-references: ECMA 262 edition 2 – section – 11.13 ECMA 262 edition 3 – section – 11.13
Adding JavaScript to HTML (Advice) The most popular use of JavaScript is in web pages. Adding it is quite simple. To add JavaScript to a web page, you can use the following techniques: ❑
The <SCRIPT> HTML tag containing the script source text
❑
From an external file using the <SCRIPT SRC="filename.js"> HTML tag and attribute
❑
From an external file using the <SCRIPT ARCHIVE="" SRC=""> HTML tag and attributes
❑
With an event handler attribute
❑
In a javascript: URL
❑
By means of a JavaScript style sheet
❑
As a JavaScript entity value for an HTML attribute
❑
Within a conditional comment
Refer to the individual topics for specific details covering each case. See also:
<SCRIPT ARCHIVE="...">, <SCRIPT SRC="...">, <SCRIPT>, <STYLE TYPE="...">, Conditional comment, Event handler, JavaScript entity, javascript: URL
Additive expression (Definition) This is an expression that adds or subtracts values. Availability:
ECMAScript edition – 2
Additive expressions use the additive operators to yield a result by operating on two values, which may themselves be expressions. See also:
Add (+), Decrement value (--), Expression, Increment value (++), Negation operator (-)
Cross-references: ECMA 262 edition 2 – section – 11.6 ECMA 262 edition 3 – section – 11.6
21
JavaScript Programmer's Reference
Additive operator (Definition) An operator that adds or subtracts values. Availability:
ECMAScript edition – 2
Here is a table summarizing all operators that can be classified as additive, even those which are primarily classified in other categories: Value
Meaning
+
Add
-
Subtract
+=
Add and assign
-=
Subtract and assign
++
Increment
--
Decrement
Additive operators perform numeric addition and subtraction or string concatenation depending on the native type of the operands. It might seem perverse to call a subtraction symbol an additive operator, but the word additive is used in the same context as multiplicative when talking about division. That is, a negative value is added to perform subtraction. It's all about the kind of logic used in the interpreter kernel. See also:
Add (+), Add then assign (+=), Arithmetic operator, Associativity, Decrement value (--), Increment value (++), Negation operator (-), Operator, Operator Precedence, Positive value (+), Postfix expression, Prefix decrement (--), Prefix expression, Prefix increment (++), String concatenate (+), String operator, Subtract (-), Subtract then assign (-=)
Cross-references: ECMA 262 edition 2 – section – 11.6 ECMA 262 edition 3 – section – 11.6
ADDRESS object (Object/HTML) An object representing the HTML content delimited by the HTML tags. Availability:
JScript – 3.0 Internet Explorer – 4.0
Inherits from:
Element object, Node object Table continued on following page
22
A – ADDRESS object (Object/HTML)
JavaScript syntax:
IE
myADDRESS = myDocument.all.anElementID
IE
myADDRESS = myDocument.all.tags ("ADDRESS")[anIndex] myADDRESS = myDocument.all[aName]
IE -
myADDRESS = myDocument.getElementById(anElementID) myADDRESS = myDocument.getElementsByName (aName)[anIndex] myADDRESS = myDocument.getElementsByTagName ("ADDRESS")[anIndex]
...
HTML syntax: Argument list:
anIndex
A reference to an element in a collection
aName
An associative array reference
anElementID Event handlers:
The ID value of an Element object onClick, onDblClick, onDragStart, onFilterChange, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onSelectStart
See Also
Element object
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onDblClick
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onDragStart
-
3.0 +
-
4.0 +
-
-
-
-
onFilterChange
-
3.0 +
-
4.0 +
-
-
-
-
onHelp
-
3.0 +
-
4.0 +
-
-
-
Warning
onKeyDown
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onKeyPress
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onKeyUp
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseDown
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseMove
1.5 +
3.0 +
6.0 +
4.0 +
-
-
4.0 +
Warning
onMouseOut
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseOver
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseUp
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onSelectStart
-
3.0 +
-
4.0 +
-
-
-
-
23
JavaScript Programmer's Reference
ADO (Product) ActiveX Data Objects is a Microsoft technology for accessing data. This is a technology that enables an ASP server to access data from a data source. It provides an easy-to-use object interface to the OLE database access mechanisms. The ADO object model is built around a set of objects of the following kinds: ❑
Command
❑
Connection
❑
Record
❑
Recordset
❑
Stream
The ADO object model includes the following collections containing objects of these types: ❑
Errors
❑
Fields
❑
Parameters
❑
Properties
This is all covered in greater depth in the Wrox book ASP 3.0 Programmers Reference, ISBN 1-861003-23-4. See also:
BODY.recordNumber, Event.bookmarks[], Input.recordNumber, SCRIPT.recordNumber, Window furniture
Adornments (Definition) The various control items that form the window border and can be selectively enabled as needed.
Aggregate type (Definition) Data types built from several atomic components. An aggregate data type is built by combining one or more atomic data types to build a more sophisticated data type. In compiled non-object-oriented languages one might create structures as aggregates of member variables. These are analogous to object classes. Arrays are another example of an aggregate data type. Other aggregate types include the various collection-based objects. See also:
24
Array object, Cast operator, Function object, Object object, Scalar type, Type
A – alert() (Method)
alert() (Method) Present the alert dialog box to the user. Availability:
JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Opera – 3.0
Property/method value type:
undefined
JavaScript syntax:
-
alert(aString)
-
myWindow.alert(aString)
Argument list:
aString
Some text to display in the alert box
See Also
Window.alert()
Alias (Definition) An indirect reference to an object. By assigning an object to a variable, you are not copying that object but instead making a reference to it. A reference is sometimes called an alias. The same technique is used in Java, and in non-object-oriented languages you accomplish something similar with pointers. See also:
Object
Alpha() (Filter/visual) A visual filter for controlling transparency. Availability:
JScript – 3.0 Internet Explorer – 4.0
25
JavaScript Programmer's Reference
AlphaImageLoader() (Filter/visual) An image is displayed in the object, with some additional control over how it is displayed. Availability:
JScript – 5.5 Internet Explorer – 5.5
See Also
Filter – AlphaImageLoader()
Anchor object (Object/HTML) An object representing an HTML tag. Availability:
DOM level – 1 JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Inherits from:
Element object, Node object
JavaScript syntax:
-
myAnchor = myAnchorArray[aName]
-
myAnchor = myAnchorArray[anIndex]
-
myAnchor = myDocument.anchors[aName]
-
myAnchor = myDocument.anchors[anIndex]
-
-
myAnchor = myDocument.getElementById(anElementID) myAnchor = myDocument.getElementsByName (aName)[anIndex] myAnchor = myDocument.getElementsByTagName ("A")[anIndex] myAnchor = myDocument.links[aName]
-
myAnchor = myDocument.links[anIndex]
IE
myAnchor = myDocument.all.anElementID
IE
myAnchor = myDocument.all.tags("A")[anIndex]
IE
myAnchor = myDocument.all[aName]
IE
myAnchor = myDocument.anchors.item(aName)[anIndex] myAnchor = myDocument.links.item(aName)[anIndex]
-
IE HTML syntax: Argument list:
... aName
An associative array reference to the anchor object.
aName
The name property of the anchor object
anIndex
An index into the anchors collection
someText
The text (or innerText) property of the anchor
anElementID
The ID value of an Element object Table continued on following page
26
A – Anchor object (Object/HTML)
Object properties:
accessKey, charset, coords, dataFld, dataSrc, hash, host, hostname, href, hreflang, Methods, mimeType, name, nameProp, pathname, port, protocol, protocolLong, recordNumber, rel, rev, search, shape, tabIndex, target, text, type, urn, x, y
Object methods:
blur(), focus()
Event handlers:
onClick, onMouseDown, onMouseOut, onMouseOver, onMouseUp
See Also:
Filter – Alpha()
This object represents a named location in the HTML document. Only those HTML tags that have a NAME attribute will have anchor objects created for them. All the anchors are listed in the anchors[] array object that belongs to the document object that represents the HTML. Although the tag is also used to create links using the HREF attribute, they are not anchors unless they are named. Any tags that have HREF attributes (whether or not they have NAME attributes) will be listed in the links[] array. In Netscape, you can construct new instances of the Anchor object, but there is no constructor property in MSIE to support this. tags and the objects that represent them are inline elements. Placing them into a document does not create a line break.
Warnings: ❑
If you put an anchor object into a document.write(), in Netscape you get a string containing the object class. In MSIE, you will get the HREF string if there is one and an empty string if there isn't.
❑
MSIE provides access to properties that would normally be considered part of the link object. Internally MSIE probably maintains a single object type for anchors and links, whereas Netscape implements two quite different classes.
❑
Netscape supports an associative reference to an anchor object within the anchors[] array according to the value of its NAME tag attribute. MSIE does not support this means of locating an anchor object in quite the same way.
❑
Note that although the syntax examples illustrate the use of an innerText property, Netscape does not support this mode of access and it will generate an error.
Example code: Click here
27
JavaScript Programmer's Reference
Click here
Click here
<SCRIPT> myLength = document.anchors.length; for (myEnumerator=0; myEnumerator<myLength; myEnumerator++ ) { document.anchors[myEnumerator].innerText = document.anchors[myEnumerator].name;}
See also:
Document.anchors[], Document.links[], Element object, Element.all[], Input.accessKey, LINK object, Location object, String.anchor(), Subclasses, Superclasses, URL, Url object, Window.scrollTo()
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
accessKey
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
Warning
charset
1.5 +
5.0 +
6.0 +
5.0 +
-
1+
-
-
coords
1.5 +
5.0 +
6.0 +
5.0 +
-
1+
-
-
dataFld
-
3.0 +
-
4.0 +
-
-
-
-
dataSrc
-
3.0 +
-
4.0 +
-
-
-
-
hash
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
host
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
hostname
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
href
1.2 +
3.0 +
4.0 +
4.0 +
-
1+
-
Warning
hreflang
1.5 +
5.0 +
6.0 +
5.0 +
-
1+
-
-
Methods
-
3.0 +
-
4.0 +
-
-
-
-
mimeType
-
3.0 +
-
4.0 +
-
-
-
Warning, ReadOnly
name
1.2 +
3.0 +
4.0 +
4.0 +
-
1+
-
Warning
nameProp
-
3.0 +
-
4.0 +
-
-
-
ReadOnly
pathname
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
port
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
protocol
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
protocolLong
-
3.0 +
-
4.0 +
-
-
-
ReadOnly
recordNumber
-
3.0 +
-
4.0 +
-
-
-
ReadOnly
rel
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
-
rev
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
-
Table continued on following page
28
A – Anchor() (Constructor)
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
search
1.2 +
3.0 +
4.0 +
4.0 +
shape
1.5 +
5.0 +
6.0 +
5.0 +
-
-
-
Warning
-
1+
-
-
tabIndex
1.5 +
3.0 +
6.0 +
target
1.2 +
3.0 +
4.0 +
4.0 +
-
1+
-
-
4.0 +
-
1+
-
Warning
text
1.2 +
-
4.0 +
-
-
-
-
Warning, ReadOnly
type
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
-
urn
-
x
1.2 +
3.0 +
-
4.0 +
-
-
-
-
-
4.0 +
-
-
-
-
Warning, ReadOnly
y
1.2 +
-
4.0 +
-
-
-
-
Warning, ReadOnly
Method
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
blur()
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
-
focus()
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
-
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick
1.2+
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseDown
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseOut
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseOver
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseUp
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
Anchor() (Constructor) You can construct new Anchor objects in Netscape. Availability:
JavaScript – 1.2 Netscape – 4.0
Property/method value type:
Anchor object
JavaScript syntax:
N
new Anchor
N
new Anchor()
N
new myAnchor.constructor
Although you can construct new anchors in Netscape, inserting them into a document is somewhat problematic since the correct way to do that would be to rewrite a fragment of HTML. You may find that replacing an anchor object in the document.anchors array links your new object to the HTML tag at the appropriate location in the document.
29
JavaScript Programmer's Reference
Warnings: ❑
This is only available on Netscape and is therefore not recommended for use in deployable applications. MSIE generates a run-time error if you attempt to make a new Anchor object. See also:
Anchor object, Anchor.host
Anchor.accessKey (Property) A key that needs to be pressed before the anchor object will respond to data entry. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myInputObject.accessKey
This is an extension that allows the anchor elements to be deadlocked unless a certain key is held down. On some browsers and operating systems, you may need to hold down one of the modifier keys for this to work. The modifier key required depends on the environment you are using.
Warnings: ❑
This is not supported in some versions of the MSIE browser on Macintosh.
Anchor.blur() (Method) Remove input focus from the Anchor object. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
JavaScript syntax:
-
myInputObject.blur()
This will trigger the onblur event handler function attached to the onblur property of the object.
30
A – Anchor.charset (Property)
Anchor.charset (Property) This property indicates the character encoding of the document at the location specified by the URL. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 5.0 Internet Explorer – 5.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.charset
This would contain the character set being used by the document. For example the value "iso-8859-1" is likely to be returned, but the local variant of the browser and OS may affect the value you get. This property might contain a value such as: csISO5427Cyrillic Details of other aliases can be located at the IANA registry. In that registry are listed the names and aliases of a wide variety of character sets. Even though there are nearly 800 names and aliases, it seems on inspection that there are items missing. See also:
LINK.charset, Url.charset
Web-references: ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets
Anchor.coords (Property) This defines an area map within an image that is inside the HTML tags. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 5.0 Internet Explorer – 5.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.coords
When a shaped area is defined within an image map, the rectangle around the shape is defined with the coords property. The value is defined with the COORDS HTML tag attribute. See also:
Anchor.shape, Area.coords, Url.coords
31
JavaScript Programmer's Reference
Anchor.dataFld (Property) This binds the anchor object to a remote data source in MSIE. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myInputObject.dataFld
This is part of the MSIE data-binding mechanism that associates a column name in the data source with the value property of an Anchor object. You must also set the dataSrc property for the object. Normally, both the dataFld and dataSrc values would be defined with the DATAFLD and DATASRC HTML tag attributes in the document source. Note that the value is case-sensitive and must refer to a column that exists within the data source. Setting both the dataFld and dataSrc properties to an empty string will disconnect the element from the database.
Anchor.dataSrc (Property) The name of a remote ODBC data source is stored in this property. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myInputObject.dataSrc
This is part of the MSIE data-binding support. It contains the name of an ODBC data source (which might be any kind of SQL database that supports such an adapter). The data source and element are bound together with each column of the data source providing a source value to different element objects through their dataFld property. Normally, both the dataFld and dataSrc values would be defined with the DATAFLD and DATASRC HTML tag attributes in the document source. Setting both the dataFld and dataSrc properties to an empty string will disconnect the element from the database.
32
A – Anchor.focus() (Method)
Anchor.focus() (Method) Brings input focus back to the anchor object. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
JavaScript syntax:
-
myInputObject.focus()
The receiving Anchor object will receive a Focus event trigger and execute its function referred to by the onfocus event handler property. The element that previously had focus (if any element did) will receive a Blur event trigger.
Anchor.hash (Property) On MSIE the Url.hash property is also available as the Anchor.hash property. Availability:
JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.hash
-
myAnchor.hash = newValue
HTML syntax:
This yields the hash suffix of the HREF value in an tag. You can assign a new value to this property, which will become a new anchor location within the document.
Warnings: ❑
This attribute may not work correctly when URLs are accessed from one frame to another in some versions of MSIE. You should check your target platforms for compliance.
❑
If you assign a value to this property in MSIE, you should omit the leading hash.
❑
Since the hash property of an Anchor object is not portable in all older browser versions, you should use the pathname property of the corresponding Url object to be able to work across MSIE and Netscape.
❑
As features become deprecated, it may become necessary to support both techniques in browserspecific code according to your needs regarding the support of legacy browsers.
33
JavaScript Programmer's Reference
See also:
Anchor object, Anchor.host, Anchor.hostname, Anchor.href, Anchor.pathname, Anchor.port, Anchor.protocol, Anchor.search, Anchor.target, URL, Url.hash, Url.host, Url.hostname, Url.href, Url.pathname, Url.port, Url.protocol, Url.search, Url.target
Anchor.host (Property) On MSIE the link.host property is also available as the anchor.host property. Availability:
JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.host
-
myAnchor.host = newHostPort
HTML syntax:
This yields the host and port value of the HREF value in an tag. You can redefine the host to request the URL by assigning a new value to this property.
Warnings: ❑
Since the host property of an Anchor object is not portable in all older browser versions, you should use the pathname property of the corresponding Url object to be able to work across MSIE and Netscape.
❑
As features become deprecated, it may become necessary to support both techniques in browserspecific code according to your needs regarding the support of legacy browsers. See also:
34
Anchor object, Anchor(), Anchor.hash, Anchor.href, Anchor.pathname, Anchor.port, Anchor.protocol, Anchor.search, Anchor.target, URL, Url.host
A – Anchor.hostname (Property)
Anchor.hostname (Property) On MSIE the link.hostname property is also available as the anchor.hostname property. Availability:
JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.hostname
-
myAnchor.hostname = newHostname
HTML syntax:
This yields the host value of the HREF value in an tag. You can redefine the hostname to request the URL by assigning a new value to this property.
Warnings: ❑
Be careful not to assign a port number with the host name, otherwise your new URL may acquire two port numbers, which makes it invalid.
❑
Since the hostname property of an Anchor object is not portable in all older browser versions, you should use the pathname property of the corresponding Url object to be able to work across MSIE and Netscape.
❑
As features become deprecated, it may become necessary to support both techniques in browserspecific code according to your needs regarding the support of legacy browsers. See also:
Anchor object, Anchor.hash, Anchor.href, Anchor.pathname, Anchor.port, Anchor.protocol, Anchor.search, Anchor.target, URL, Url.hostname
Anchor.href (Property) On MSIE the link.href property is also available as the anchor.href property. Availability:
DOM level – 1 JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.href
-
myAnchor.href = newHref
HTML syntax:
35
JavaScript Programmer's Reference
This yields the entire value of the HREF attribute in an tag. You can redefine the entire HREF content by assigning a new value to this property.
Warnings: ❑
Since the href property of an Anchor object is not portable in all older browser versions, you should use the pathname property of the corresponding Url object to be able to work across MSIE and Netscape.
❑
As features become deprecated, it may become necessary to support both techniques in browserspecific code according to your needs regarding the support of legacy browsers. See also:
Anchor object, Anchor.hash, Anchor.host, Anchor.hostname, Anchor.pathname, Anchor.port, Anchor.protocol, Anchor.search, Anchor.target, Location.href, URL, Url.href
Anchor.hreflang (Property) The language code of the document at the location specified by the URL. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 5.0 Internet Explorer – 5.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.hreflang
This property should contain values that use the international language two-letter abbreviation codes. These are not the same as the country codes, which are also two letter values. Refer to the Language codes topic for a list of the available language codes. See also:
Language codes, LINK.hreflang
Anchor.Methods (Property) A property that can indicate some keywords regarding the action that the server provides when the link is clicked on. These reflect the request methods.
36
Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myAnchor.Methods
A – Anchor.mimeType (Property)
The possible values of this property are those of the valid methods for the HTTP protocol. It could be one of the following: ❑
GET
❑
HEAD
❑
POST
❑
PUT
❑
DELETE
❑
OPTIONS
❑
TRACE
It is likely that only the GET and POST methods make any logical sense in this context. On rare occasions, the PUT method may be referred to, although it is unusual to find a web server that accepts documents with this request method. Likewise DELETE is normally only supported within very strict constraints. The method name can be specified in upper or lower case. See also:
Url.Methods
Anchor.mimeType (Property) Contains a long form human readable version of the MIME type of the document at the location specified by the anchor's URL. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myAnchor.mimeType
The MSIE browser maps the file extension of the file belonging to the anchor to an extended description of the file format, which it makes available through the mimeType property. Here is a list of some mimeType values it pays special attention to. File type:
MSIE expanded Mime type:
.css
Microsoft CSS1 Style Sheet (W3C would have been more appropriate)
.gif
GIF Image
.htc
Microsoft HTML Component file for behaviors
.htm
Microsoft HTML Document 4.0
.html
Microsoft HTML Document 4.0
.jpg
JPEG Image
37
JavaScript Programmer's Reference
File type:
MSIE expanded Mime type:
.js
Microsoft JScript File
.txt
Text Document
.vbs
Microsoft VBScript File
.xxx
All unrecognized file types are returned as xxx File with no further expansion
Microsoft asserts that .htm and .html files are "Microsoft HTML" and .css files are "Microsoft CSS1" style sheets. It also asserts that .js files are "Microsoft JScript" files. Microsoft doesn't really own those file extensions across all platforms, nor indeed does it even own them on the Windows platform.
Warnings: ❑
Do not confuse this value with other mimeType properties. For example the Navigator object has a mimeTypes[] collection property with references to mimeType objects. The mimeType property of an MSIE Anchor object is a simple string primitive value and not a mimeType object. See also:
MIME types, Url.mimeType
Property attributes: ReadOnly.
Anchor.name (Property) This corresponds to the NAME attribute of the HTML tag. Availability:
DOM level – 1 JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.name
-
myAnchor.name = aName
HTML syntax:
Argument list:
aName
A new name for the anchor.
The value of this property is defined by the NAME tag attribute in the HTML that describes the document. Without the NAME attribute, the anchor object does not get added to the anchors[] array.
38
A – Anchor.nameProp (Property)
This name property contains a case-sensitive value. It is case-sensitive because it can be used as a value in one of the document hierarchies to locate an object. The example should present the word "EXAMPLE" on all compliant browsers.
Warnings: ❑
This value is read/write in MSIE, but read-only in Netscape. Logically there is not much purpose in changing the name of an anchor anyway.
❑
Beware that assigning a new name will affect the length of the document.anchors[].
❑
Changing the name in MSIE actually adds a new item to the document.anchors[] array that can be reached associatively with the new name. There will now be two entries for the same anchor and you can continue to access it using the old name as well.
❑
If you are writing portable code and expect it to work in both MSIE and Netscape Navigator, this is the only property available in both browsers. Having located an anchor, being able to access only its name without any browser dependencies is rather limiting.
Example code: Click here
<SCRIPT> document.write(document.anchors[0].name);
See also:
Anchor object, AnchorArray.length, Document.anchors[], NAME="...", String.anchor(), Url.name
Anchor.nameProp (Property) The filename portion of the URL value. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myAnchor.nameProp
This property extracts the filename portion of the HREF value for this tag. See also:
Url.nameProp
Property attributes: ReadOnly.
39
JavaScript Programmer's Reference
Anchor.pathname (Property) In MSIE the Url.pathname property is also available as the Anchor.pathname property. Availability:
JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.pathname
-
myAnchor.pathname = newPath
HTML syntax:
This yields the pathname portion of the HREF attribute in an tag. MSIE and Netscape support the use of this property as an LValue. If you write to it, the pathname portion of the HREF value is modified. Be careful not to include a hash or search/query value.
Warnings: ❑
Since the pathname property of an Anchor object is not portable in all older browser versions, you should use the pathname property of the corresponding Url object to be able to work across MSIE and Netscape.
❑
As features become deprecated, it may become necessary to support both techniques in browserspecific code according to your needs regarding the support of legacy browsers. See also:
Anchor object, Anchor.hash, Anchor.host, Anchor.hostname, Anchor.href, Anchor.port, Anchor.protocol, Anchor.search, Anchor.target, URL, Url.pathname
Anchor.port (Property) In MSIE the Url.port property is also available as the Anchor.port property. Availability:
JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.port
-
myAnchor.port = newPort
HTML syntax:
40
A – Anchor.protocol (Property)
This yields the port number value of the HREF attribute in an tag. You can assign a value to this property as if it were an LValue.
Warnings: ❑
Since the port property of an Anchor object is not portable, you should use the port property of the corresponding Url object to be able to work across MSIE and Netscape.
❑
Do not include the delimiting colon when you assign a value to this property.
❑
Make sure you assign a numeric value. Non-numeric values will be rejected to avoid the possibility of a completely invalid port number being used. See also:
Anchor object, Anchor.hash, Anchor.host, Anchor.hostname, Anchor.href, Anchor.pathname, Anchor.protocol, Anchor.search, Anchor.target, URL, Url.port
Anchor.protocol (Property) In MSIE the Url.protocol property is also available as the Anchor.protocol property. Availability:
JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.protocol
-
myAnchor.protocol = newProtocol
HTML syntax:
This yields the protocol value of the HREF attribute in an tag. Using this property as an LValue, you can redefine the protocol for the link if it has an HREF. You might want to do this if you want to change the way you access a particular document. The URL topic enumerates a large number of available protocols that can be used in SRC and HREF HTML tag attributes.
Warnings: ❑
Since the protocol property of an Anchor object is not portable, you should use the protocol property of the corresponding Url object to be able to work across MSIE and Netscape.
See also:
Anchor object, Anchor.hash, Anchor.host, Anchor.hostname, Anchor.href, Anchor.pathname, Anchor.port, Anchor.search, Anchor.target, IMG.protocol, URL, Url.protocol
41
JavaScript Programmer's Reference
Anchor.protocolLong (Property) A long form description of the protocol used by the URL. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myAnchor.protocolLong
Only the MSIE browser supports this property. Its use would be limited even if it were available across multiple platforms. See also:
Url.protocolLong
Property attributes: ReadOnly.
Anchor.recordNumber (Property) The record within the data set that defined the element content when the content came from a data source. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myBody.recordNumber
This is a property that is part of the MSIE data-binding support. It contains an integer value that is the record number within the data set that created this object. This is useful when you are building pages with Active Server Pages (ASP) and ActiveX Data Objects (ADO).
Property attributes: ReadOnly.
42
A – Anchor.rel (Property)
Anchor.rel (Property) A definition of the relationship between the current document and the document at the location specified by the URL. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.rel
This is sometimes called a forward link. Although the HREF HTML tag attribute is normally the only means used to identify a target document, the browser is permitted to use the REL HTML tag attribute to decide whether to use the HREF value or how it should be used. The following HTML version 4.0 standard link types are permitted in this property: ❑
alternate
❑
appendix
❑
bookmark
❑
chapter
❑
contents
❑
copyright
❑
glossary
❑
help
❑
index
❑
next
❑
prev
❑
section
❑
start
❑
stylesheet
❑
subsection
MSIE adds these as well: ❑
same
❑
next
❑
parent
❑
previous
When used or tested within a script, any comparisons should be case-insensitive. See also:
Anchor.rev, LINK.rel
43
JavaScript Programmer's Reference
Anchor.rev (Property) A complementary description of the link to the current document as viewed from the document at the location specified by the URL. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.rev
This is sometimes called a reverse link. It defines the relationship between a document and another that calls it. The linkage is defined from the destination document's viewpoint. This property supports the same HTML version 4.0 standard link types as the rel property. Refer to that topic for details. When used or tested within a script, any comparisons should be case-insensitive. Because rel and rev properties are complementary, the values in them are likely to be related. For example, if one contains the value "next" then the other is likely to contain "previous". Refer to the Anchor.rel topic for a list of the available types you can use in this property. See also:
Anchor.rel, LINK.rev
Anchor.search (Property) The query portion of an HREF URL if there is one. Availability:
JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.search
-
myAnchor.search = newSearch
HTML syntax:
Warnings: ❑
44
Since the search property of an Anchor object is not portable, you should use the search property of the corresponding link object to be able to work across MSIE and Netscape.
A – Anchor.shape (Property)
See also:
Anchor object, Anchor.hash, Anchor.host, Anchor.hostname, Anchor.href, Anchor.pathname, Anchor.port, Anchor.protocol, Anchor.target, request., URL, Url.search
Anchor.shape (Property) A map whose extent is defined by the coords property and which can be one of several different shapes. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 5.0 Internet Explorer – 5.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.shape
This property has a meaningful value when the Anchor object is instantiated via <MAP> and tag. It defines the shape of the hotspot within the extent rectangle defined by the coords property. It might contain one of the following values: ❑
default
❑
rect
❑
circle
❑
poly See also:
Anchor.coords, Area.shape, Url.shape
Anchor.tabIndex (Property) A control of where the Anchor object appears in the tabbing order of the page. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myInputObject.tabIndex
45
JavaScript Programmer's Reference
This value indicates where in the tabbing sequence this object and any of its children will be placed. The tabbing order is used when filling in forms or moving focus. Pressing the [tab] key moves from one form element to the next according to the cascaded tabbing order defined by building a tree-like structure with the tab index values.
Anchor.target (Property) In MSIE the Url.target property is also available as the Anchor.target property. Availability:
DOM level – 1 JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.target
-
myAnchor.target = newTarget
HTML syntax:
This yields the value of the TARGET attribute in an , , or <MAP> tag. You can assign a new value to this property so that the URL will be directed to a different window or frame. Here are some example target values: ❑
_parent
❑
_self
❑
_top
❑
_blank
❑
Window name
❑
Frame name
Warnings: ❑
Since the target property of an Anchor object is not portable, you should use the target property of the corresponding link object to be able to work across MSIE and Netscape. See also:
46
<MAP TARGET="...">, Anchor object, Anchor.hash, Anchor.host, Anchor.hostname, Anchor.href, Anchor.pathname, Anchor.port, Anchor.protocol, Anchor.search, BASE.target, Form.target, Location.target, Map.target, URL, Url.target
A – Anchor.text (Property)
Anchor.text (Property) The text between the and HTML tags in Netscape. Availability:
JavaScript – 1.2 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
N
myAnchor.text
N
myAnchor.text = aString
HTML syntax:
someText
Argument list:
aString
Some new text content for the anchor
This is equivalent to the innerText value that MSIE supports. It only works on Netscape and is somewhat less reliable than the innerText property in MSIE. Assigning to this property in MSIE simply creates a text property, but does not affect the text of the anchor. The value yielded by this property (when it does work) is the text between the and tags.
Warnings: ❑
You will need to detect the browser type before attempting to use this property.
❑
Does not work on Netscape Navigator version 4.7 on the Macintosh. Instead it displays some fragment of body text that comes from outside the anchor tags.
❑
Even if it does work, you may only extract a portion of the text from the anchor. See also:
Anchor object, Element.innerText, Url.text
Property attributes: ReadOnly.
Anchor.type (Property) A MIME type value in its abbreviated machine recognizable form. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myAnchor.type
47
JavaScript Programmer's Reference
The MIME type of the document associated with the Anchor object is accessible through the value of this property. Refer to the MIME type topic for details of the available MIME types you will likely see in this property. See also:
LINK.type, MIME types
Anchor.urn (Property) An alternative format of the contents of the URL. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
See also:
URN
myAnchor.urn
Anchor.x (Property) The X location of the anchor within the document. Availability:
JavaScript – 1.2 Netscape – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
N
myAnchor.x
N
myAnchor.x = aValue
aValue
A new X coordinate value
Argument list:
The Anchor.x property yields the pixel distance of the anchor from the left edge of the document. The horizontal position of the object in the display is measured in pixels. You can use the x and y coordinates of the object as targets of the scrollTo() method for the window it lives in.
Warnings: ❑
This is not supported by MSIE. Instead you can use the offsetLeft property that is inherited from the Element object super-class. There may be some occasions when this is not an exact equivalent value though. See also:
48
Anchor object, Element.offsetLeft, Location.x
A – Anchor.y (Property)
Property attributes: ReadOnly.
Anchor.y (Property) The Y location of the anchor within the document. Availability: Property/method value type: JavaScript syntax: Argument list:
JavaScript – 1.2 Netscape – 4.0 Number primitive N
myAnchor.y
N
myAnchor.y = aValue
aValue
A new Y coordinate value
The Anchor.y property yields the pixel distance of the anchor from the top edge of the document. The vertical position of the object in the display is measured in pixels. You can use the x and y coordinates of the object as targets of the scrollTo() method for the window it lives in.
Warnings: ❑
This is not supported by MSIE. Instead you can use the offsetTop property that is inherited from the Element object super-class. There may be some occasions when this is not an exact equivalent value though. See also:
Anchor object, Element.offsetTop, Location.y
Property attributes: ReadOnly.
AnchorArray object (Object/DOM) An array of Anchor objects retrieved from the document.anchors property. Availability:
DOM level – 1 JavaScript – 1.0 JScript – 3.0 Internet Explorer – 4.0 Netscape – 2.0
JavaScript syntax:
-
Object properties:
length
myAnchorArray = myDocument.anchors
49
JavaScript Programmer's Reference
The AnchorArray object is a sub-class of the Array object but has no additional properties. It responds to the length property request as you would expect. Any Anchor objects in this array can be accessed by index value because the Array class supports that. In Netscape, the individual Anchor objects are accessible associatively by their NAME attribute. However, MSIE does not make this associative mechanism available. In MSIE, the AnchorArray object is a kind of Collection object and so it can be searched with the item() and tags() methods.
Warnings: ❑
Netscape adds a constructor property to this object class from which you can request the name to determine the object class. Actually Netscape provides constructors for virtually everything, but MSIE only supports them when it's necessary and useful.
❑
Be aware that renaming an anchor in MSIE will add a new item to the AnchorArray collection without destroying the old one. However, the length property remains the same. It does mean that you could have problems enumerating the collection. But then, why would you ever want to rename an anchor after it has been instantiated and named within the HTML tag?
Example code: anIndex
An item within the collection
aString
A comment string
aName
The name of an element
anElementID
The ID attribute of an element
Object properties:
text
Object methods:
click(), getAttribute(), removeAttribute(), setAttribute()
Collections:
all[], children[]
It is somewhat unlikely you would ever want to modify the contents of a comment tag. However, access to the text contained within it may be a way of passing hidden data values to your scripts without them being visible in the displayed page. Of course they would still be visible in the document source, but you might be able to avoid the creation of a and hidden object.
316
C – COMMENT.text (Property)
Warnings: ❑
The DOM level 1 specification describes this as a Comment object, but MSIE implements it as a COMMENT object instead. You may need to be aware of this in case other platforms implement the DOM specified class exactly as it is intended. See also:
CharacterData object, Document.createComment(), Element object, Hiding scripts from old browsers
Property
JavaScript
JScript
N
IE
Opera
DOM
Notes
text
-
3.0 +
-
4.0 +
-
-
-
Method
JavaScript
JScript
N
IE
Opera
DOM
Notes
click()
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
Warning
getAttribute()
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
Warning
removeAttribute()
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
Warning
setAttribute()
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
Warning
Inheritance chain: CharacterData object, Node object
COMMENT.text (Property) The text within a comment block. Availability:
JScript – 3.0 Internet Explorer version – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myCOMMENT.text
This is the internal text within the comment block. The DOM standard treats comment blocks as character data to standardize the access to their content, but you should not expect to be able to access the internal text of a comment for any functional purpose.
Compatibility (Definition) Creating web content is an exercise in portable programming that would severely test the most experienced programmer. There are so many issues to do with portability and compatibility that unless you are doing something very simple, its is an amazing achievement to get your web page to display even remotely similarly on several browsers or platforms.
317
JavaScript Programmer's Reference
Leaving aside the creative issues to do with color matching, gamma correction, and display resolution, there are problems with fonts, style sheets and table layout. Layers and dynamic HTML behave differently even within the same browser family as the browsers are revised. Even scrolling a page means you have to increment the scroll value in opposite directions in Netscape and MSIE, and Netscape won't scroll at all without the scroll bars being visible. To cope with this, it helps to break the compatibility issues down into sub-sets and to understand the underlying reason for incompatibility. You do need to know about and be able to identify issues based on platforms, browsers, or versions of client software. See also:
, <SCRIPT LANGUAGE="...">, Browser version compatibility, Compatibility strategies, Cross browser compatibility, Cross platform compatibility, Defensive coding, Document, Plugin compatibility issues, Portability, Server-side browser detection
Cross-references: Wrox Instant JavaScript – page – 60
Compatibility strategies (Advice) Choose how compatible you want to be from the outset. You need to establish a strategy for how compatible you need to be. Here are some questions you need to think about and consider their relative importance. ❑
Is it important that your pages work perfectly in browsers that do not support JavaScript? If so, don't deploy any at all.
❑
If you really need JavaScript, can you design your forms and page content to degrade gracefully? If not, you may need to browser-detect and present warnings. If you cannot browser-detect with JavaScript at the client end, you may need to browser-detect at the server end and return a different page.
❑
Are you in control of browser deployment to the target desktop systems? This is likely in an intranet situation. If it is true, then you can use all of the features of the browser your deploy, including platform-specific and version-specific capabilities. You may need to co-ordinate content upgrades with browser upgrades though.
❑
Are you only using JavaScript to define proxy settings? If so, you only need to be cross-platform and browser-version aware.
❑
Are you only using JavaScript to set preference values in Netscape? If so, you only need to be cross-platform and browser-version aware.
❑
Can you sacrifice old-browser users? If you can get some meaningful statistics of your readership, you may find that only a few percent have an old browser. Are you prepared to support all users or can you disregard some? You need to set a threshold, say 5%, and work out a sub-set of browsers that you will support and from that derive a functionality profile that your must enforce in your design department.
❑
Must you guarantee to work on all browsers of every vintage? In which case, you could consider the lowest common denominator approach and only use those capabilities that are supported by your choice of target browsers.
318
C – Completion type (Definition)
❑
Do you think you need to only support the latest version of a browser? Users are generally keen to upgrade if it is well worth their while. They likely may not consider your site a compelling reason to upgrade though.
❑
Are you hardwired to a very specific platform/browser combination? Some sites only work on MSIE running on Windows. This is very frustrating for Netscape users or people using any web browser on other non-Windows platforms. Things change and you cannot rely on Microsoft Windows always being the dominant platform. This could change within the hardware replacement cycle that large corporations like to implement. That might be between 2 and 4 years. If your site only works on a single platform, your traffic may go down as that platform loses market share.
❑
Do you just not care about it? If your page breaks on someone's browser, so what? Maybe it's not important at all. However, don't expect that user to come back – ever. If the script fails to draw some cute animation or change a color the effect is likely to be cosmetic anyway and may not even be noticed. Maybe it fails fairly gracefully if you are lucky. See also:
Compatibility, Date object
Completion type (Definition) An internal type used by the interpreter. Availability:
ECMAScript edition – 2
This is an internal type used by the interpreter for processing expression evaluation results. It cannot be stored as an object property. A completion happens when a statement is evaluated and completes normally. A completion can involve a value and may still be a normal completion. Abrupt completions are triggered by break, continue, and return statements, which are all classified as program steps that may redirect the flow of control. This may cause sections of code to be skipped or repeated. In the case of a return, it may prematurely exit a function. In the set of ECMA-defined reserved words, there is evidence that new flow control changes may be introduced and therefore other completion type values may be added later. The set of completion type values are summarized in this table: Type:
Reason:
Normal completion
-
Normal completion after evaluation Abrupt completion
break
Abrupt completion after evaluation
break
Abrupt completion
continue
Abrupt completion after evaluation
continue
Abrupt completion
return
Abrupt completion after evaluation
return
319
JavaScript Programmer's Reference
See also:
break, continue, Identifier resolution, return, Scope chain, Type
Cross-references: ECMA 262 edition 2 – section – 8.9 ECMA 262 edition 3 – section – 8.9
Compliance (Overview) The degree to which an implementation adheres to the standard. The formal definition of the core JavaScript language is embodied in the ECMA standard 262. Until recently, where implementations conformed it was to the second edition of the standard, which was published in August 1998. In December 1999, the third edition was made available and new implementations or revisions to existing products released in the early part of the year 2000 onwards complied with that new version of the standard. To comply with the standard, an implementation must provide and support all the types, values, objects, properties, methods, and program syntax described in the standard. See also:
Behavior, Conformance, Definition, ECMA, ECMAScript, ECMAScript – edition 2, ECMAScript – edition 3, Limits
Compositor() (Filter/visual) As content is added to an object, it can be colored to indicate it is changed content. Availability:
JScript – 5.5 Internet Explorer – 5.5
Refer to: Filter - Compositor()
Compound statement (Definition) A block of code handled as if it were one statement. A compound statement is a block of one or more statements gathered together and executed as if they were a single statement. This is a somewhat wordy description of what a function declaration provides. Other similar uses are the code that is iterated in a while or for loop and the code that is conditionally executed in an if ... else construct.
320
C – Concatenate (+) (Operator/string)
Any variables created within a compound statement will be local to the enclosing function if the compound statement exists inside a function's execution context, otherwise they will be globally scoped. In JavaScript you cannot localize the scope of a variable to within an if(), while(), or for() construct in the way that you can in C language. See also:
Definition, for( ... in ... ) ..., Function code, if( ... ) ..., if( ... ) ... else ..., Scope chain, Statement, var, while( ... ) ...
Concatenate (+) (Operator/string) Join two strings end to end. See Addition for numeric values. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0
Property/method value type:
String primitive
See also:
Add (+), Additive operator, Array.join(), Array.toString(), Concatenate then assign (+=), String, String, String literal, String object, String operator, String.concat(), String.split(), Type conversion, String concatenate (+)
Cross-references: ECMA 262 edition 2 – section – 11.6.1 Wrox Instant JavaScript – page – 21
Concatenate then assign (+=) (Operator/assignment) Concatenate two string operands and assign the result to the first. See Addition for numeric values. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0
Property/method value type:
Number primitive
321
JavaScript Programmer's Reference
JavaScript syntax: Argument list:
-
anOperand1 += anOperand2
anOperand1
A numeric value that can be assigned to
anOperand2
Another numeric value
Concatenate the right operand to the left operand and assign the result to the left operand. This is functionally equivalent to the expression: anOperand1 = anOperand1 + anOperand2; Although this is classified as an assignment operator, it is really a compound of an assignment and a concatenation operator. It also works with numeric values and will add the second to the first. The associativity is right to left. Refer to the Operator Precedence topic for details of execution order. The new value of anOperand1 is returned as a result of the expression.
Warnings: The operand to the left of the operator must be an LValue. That is, it should be able to take an assignment and store the value.
❑
See also:
Add then assign (+=), Assign value (=), Assignment expression, Assignment operator, Associativity, LValue, Operator Precedence
Cross-references: ECMA 262 edition 2 – section – 11.13 ECMA 262 edition 3 – section – 11.13
Conditional code block (Pre-processor) A pseudo pre-processor mechanism for conditionally executing code in MSIE. There is an implementation of a C language inspired pre-processor in the MSIE JScript interpreter. The usual pre-processor directives for conditional code use are reproduced here except that in the C language they are prefixed with a hash symbol (#) and in JScript the commercial at sign (@) is used instead. There are several directives and a set of pre-defined constants ❑
@cc_on Statement
❑
@if Statement
322
C – Conditional comment (HTML Tag)
❑
@set Statement
❑
@elif( ... ) ... Statement
❑
@else ... Statement
❑
@end Statement
❑
@ Reference
❑
@_alpha Pre-defined constant
❑
@_jscript Pre-defined constant
❑
@_jscript_build Pre-defined constant
❑
@_jscript_version Pre-defined constant
❑
@_mac Pre-defined constant
❑
@_mc680x0 Pre-defined constant
❑
@_PowerPC Pre-defined constant
❑
@_win16 Pre-defined constant
❑
@_win32 Pre-defined constant
❑
@_x86 Pre-defined constant
Warnings: ❑
This is not supported prior to MSIE version 4. See also:
Pre-processing - @cc_on, Pre-processing - @elif( ... ) ..., Pre-processing - @else ..., Pre-processing - @end, Preprocessing - @if( ... ) ...
Conditional comment (HTML Tag) A portability trick that only works in Netscape. Availability:
JavaScript – 1.2 Netscape – 4.0
Conditional comments use JavaScript entities to enclose a block of JavaScript and only execute it conditionally on some value being true. It is accomplished by embedding a JavaScript entity with a logical expression evaluation in it. If the expression proves true then the <SCRIPT> HTML tag enclosed in the comment block is parsed, otherwise it is ignored. This is how it's done. A conditional comment is formed by adding an ampersand character to the leading tag of a comment. Rather than use "
See also:
Adding JavaScript to HTML
Conditional expression (Definition) Conditionally execute one code branch or another. Availability:
ECMAScript edition – 2
Conditional expressions test a logical expression and perform one of two possible alternative code blocks. The grammar for a conditional expression in ECMA-compliant JavaScript implementation is slightly different from that you may have seen before in Java and C language. Java and C set restrictions on the kind of expression you can put into the second code block, whereas JavaScript does not. This is a subtle distinction and is intended to simplify the use of this expression and avoid the use of a comma operator. See also:
Conditionally execute (?:), Expression
Cross-references: ECMA 262 edition 2 – section – 11.12 ECMA 262 edition 3 – section – 11.12 Wrox Instant JavaScript – page – 18
Conditional operator (Definition) Conditionally execute one code branch or another. Availability:
324
ECMAScript edition – 2
C – Conditionally execute (?:) (Operator/conditional)
Refer to: Conditionally execute (?:)
Cross-references: ECMA 262 edition 2 – section – 11.12 ECMA 262 edition 3 – section – 11.12
Conditionally execute (?:) (Operator/conditional) Conditionally execute one code branch or another. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Depends on arguments
JavaScript syntax:
-
Argument list:
aCondition ? someCode : moreCode
aCondition
A relational or logical expression that yields true or false
moreCode
Code that is executed if aCondition is false
someCode
Code that is executed if aCondition is true
The two associated code blocks are executed according to the value yielded by a Boolean test on the first operand. If it is true, then the first code block is executed, otherwise the second is used. The associativity is right to left. Refer to the Operator Precedence topic for details of execution order. This is sometimes called a Ternary operator, because it takes three operands.
Example code: <SCRIPT> mySwitch = false; myResult = (mySwitch) ? "TRUE VALUE" : "FALSE VALUE" ; document.write(myResult);
325
JavaScript Programmer's Reference
See also:
Associativity, Conditional expression, Flow control, if( ... ) ..., if( ... ) ... else ..., Operator Precedence, Selection statement, Ternary operator
Cross-references: ECMA 262 edition 2 – section – 11.12 ECMA 262 edition 3 – section – 11.12
config.jsc (Special file) A JavaScript configuration file for Netscape.
Refer to: Preferences
Cross-references: Wrox Instant JavaScript – page – 59
confirm() (Method) A dialog box to get confirmation from the user. Availability:
JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Opera – 3.0
Property/method value type:
Boolean primitive
JavaScript syntax:
-
myResult = confirm(aString)
-
myResult = myWindow.confirm(aString) Some text to explain what is to be confirmed
Argument list:
aString
See also:
Window.alert(), Window.confirm()
326
C – Conformance (Definition)
Conformance (Definition) An interpreter may or may not conform to the ECMAScript specification. Availability:
ECMAScript edition – 2
Conforming implementations of ECMA 262 edition 2 must properly support Unicode version 2.0 and ISO/IEC 10646-1 with UCS-2 as the encoding form. There are various sub-clauses to that encoding requirement and implementers should build their systems around the specifications laid down therein. Edition 3 requires slightly different character coding support. Conforming implementations may provide additional capabilities. In particular, functionality flagged under the 'Future Reserved Word' category is encouraged by ECMA. A strictly conforming implementation is one that only provides the features outlined in the standard. Since ECMAScript only defines core functionality and absolutely none of the host environment, a strictly conforming implementation of ECMAScript would be of limited use. A conforming implementation provides the behavior outlined in the standard with some allowable additional behavior to support the hosting environment. See also:
Compliance, ECMA, ECMAScript, ECMAScript – edition 2, ECMAScript – edition 3
Cross-references: ECMA 262 edition 2 – section – 2 ECMA 262 edition 3 – section – 2
Connection object (Object/NES) An object that represents a connection from the server to the back-end database. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
JavaScript syntax:
NES
Argument list:
myConnection = myDbPool.connection(aName, aTimeout)
aName
A connection name
aTimeout
Timeout in seconds
Object properties:
prototype
Object methods:
beginTransaction(), commitTransaction(), connected(), cursor(), execute(), majorErrorCode(), majorErrorMessage(), minorErrorCode(), minorErrorMessage(), release(), rollbackTransaction(), SQLTable(), storedProc(), toString()
This object is used to maintain the connection state details between the Netscape Enterprise Server and the backend database it is retrieving data from. A connection object is created by calling the connection() method of the DbPool object.
327
JavaScript Programmer's Reference
Example code: <SERVER> // An example of how to create a connection object // Based on the one in Wrox Professional JavaScript myDbPool = new DbPool("ODBC", "myDatabase", "", "", ""); myConnection = myDbPool.connection("ExampleConnection", 30); myConnection.SQLTable("SELECT * FROM MY_TABLE");
See also:
DbPool.connection(), Netscape Enterprise Server, unwatch(), watch()
Property
JavaScript
JScript
NES
Notes
prototype
1.2 +
-
3.0 +
-
Method
JavaScript
JScript
NES
Notes
beginTransaction()
1.2 +
-
3.0 +
-
commitTransaction()
1.2 +
-
3.0 +
-
connected()
1.2 +
-
3.0 +
-
cursor()
1.2 +
-
3.0 +
-
execute()
1.2 +
-
3.0 +
-
majorErrorCode()
1.2 +
-
3.0 +
-
majorErrorMessage()
1.2 +
-
3.0 +
-
minorErrorCode()
1.2 +
-
3.0 +
-
minorErrorMessage()
1.2 +
-
3.0 +
-
release()
1.2 +
-
3.0 +
-
rollbackTransaction()
1.2 +
-
3.0 +
-
SQLTable()
1.2 +
-
3.0 +
-
storedProc()
1.2 +
-
3.0 +
Warning
toString()
1.2 +
-
3.0 +
-
Connection.beginTransaction() (Method) Commence a new transaction with the database. Availability:
JavaScript – 1.2 Netscape Enterprise Server version – 3.0
JavaScript syntax:
NES
myConnection.beginTransaction()
Call this method to signify the start of a new transaction with the database. This is a reference point to which you can rollback the changes if necessary. Note that you cannot rollback after the commit has occurred.
328
C – Connection.commitTransaction() (Method)
Connection.commitTransaction() (Method) Commit the changes made to the database. Availability:
JavaScript – 1.2 Netscape Enterprise Server version – 3.0
JavaScript syntax:
NES
myConnection.commitTransaction()
Relational databases support the facility of a two phase commit. That is, any changes made to the database require that a commit is requested before the session is disconnected. If the session is disconnected without a commit, then the changes are unwound and discarded leaving the database in the state it was in after the previous commit. Sometimes people place a commit after every transaction. This is somewhat wasteful and can lead to low performance. Placing a commit every 25 or so transactions is better. You do need to be sure that you have made the changes you need to and that any referential integrity is maintained and any constraints on the data are satisfied, otherwise the commit may fail.
Connection.connected() (Method) A method that returns a flag indicating the state of the connection. Availability:
JavaScript – 1.2 Netscape Enterprise Server version – 3.0
Property/method value type:
Boolean primitive
JavaScript syntax:
NES
myConnection.connected()
If the session is currently connected to the database, this method will return a true value. If the session is no longer connected it yields false.
Connection.cursor() (Method) Create a cursor object on the connection with the SQL database. Availability:
JavaScript – 1.2 Netscape Enterprise Server version – 3.0
Property/method value type:
Cursor object
JavaScript syntax:
NES
Argument list:
myConnection.cursor(aQuery, aFlag) NES aQuery A valid SQL query for the database aFlag Indicates whether the cursor can be updated
myConnection.cursor(aQuery)
329
JavaScript Programmer's Reference
These Cursor objects are used to run SQL queries against the database we are currently connected to. It is probably a good idea to consult the reference documentation for your database to fully understand how it handles cursors. See also:
Cursor object
Connection.execute() (Method) Execute some SQL on the database. Availability:
JavaScript – 1.2 Netscape Enterprise Server version – 3.0
Property/method value type:
String primitive
JavaScript syntax:
NES
Argument list:
someSQL
myConnection.execute(someSQL) A string containing valid SQL for the database
The SQL to be executed on the database is passed as an argument to this method.
Connection.majorErrorCode() (Method) Provide the code for an error raised by the database server or the ODBC interface to it. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
Property/method value type:
String primitive
JavaScript syntax:
NES
myConnection.majorErrorCode()
For a status code value of 5 when using the Oracle database, this yields a return code from the Oracle Call-level interface. For a status code value of 5 when using SQL server through the ODBC database interface, this yields the SQL server message number. For a status code value of 7 when using the Informix database, this yields the Informix error code. For a status code value of 7 when using the Sybase database, this yields the DB-Library error number. See also:
330
database.majorErrorCode(), DbPool.majorErrorCode(), Error handling, Status code
C – Connection.majorErrorMessage() (Method)
Connection.majorErrorMessage() (Method) Provide the descriptive text message for an error raised by the database server or by the ODBC interface to it. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
Property/method value type:
String primitive
JavaScript syntax:
NES
myConnection.majorErrorMessage()
For a status code value of 5 when using the Oracle database, this yields a text string describing the server error. For a status code value of 5 when using SQL server through the ODBC database interface, this yields a text string from SQL server. For a status code value of 7 when using the Informix database, this yields the text string from the vendor error library. For a status code value of 7 when using the Sybase database, this yields a text string from the DB-Library. See also:
database.majorErrorMessage(), DbPool.majorErrorMessage(), Error handling, Status code
Connection.minorErrorCode() (Method) Returns a supplementary error code for an error raised by the database server or the ODBC interface to it. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
Property/method value type:
String primitive
JavaScript syntax:
NES
myConnection.minorErrorCode()
For a status code value of 5 when using the Oracle database, this yields an operating system error code from the Oracle Call-level interface. For a status code value of 5 when using SQL server through the ODBC database interface, this yields the severity level from SQL server. For a status code value of 7 when using the Informix database, this yields the ISAM error code. For a status code value of 7 when using the Sybase database, this yields the severity level of the error from the DB-Library. See also:
database.minorErrorCode(), DbPool.minorErrorCode(), Error handling, Status code
331
JavaScript Programmer's Reference
Connection.minorErrorMessage() (Method) Returns a supplementary error message text for an error raised by the database server or the ODBC interface to it. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
Property/method value type:
String primitive
JavaScript syntax:
NES
myConnection.minorErrorMessage()
For a status code value of 5 when using the Oracle database, this yields the Oracle server name. For a status code value of 5 when using SQL server through the ODBC database interface, this yields the SQL server name. For a status code value of 7 when using the Informix database, this yields a text string describing the ISAM error. For a status code value of 7 when using the Sybase database, this yields the text of the operating system error from the DB-Library. See also:
database.minorErrorMessage(), DbPool.minorErrorMessage(), Error handling, Status code
Connection.prototype (Property) The prototype for the connection object that can be used to extend the interface for all connection objects. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
Property/method value type:
Connection object
JavaScript syntax:
NES
Connection.prototype
NES
myConnection.constructor.prototype
Refer to: prototype property
Connection.release() (Method) Releases this connection back into the pool for reuse. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
JavaScript syntax:
NES
332
myConnection.release()
C – Connection.rollbackTransaction() (Method)
There are a limited number of connections available for accessing the database. This is intentional. It prevents the database from being swamped by connections. The limit may be large or small depending on the scale of the database server and the software it is using. Requesting a connection from the DbPool object consumes one of the available connections. You must ensure that you release them back to the pool when you are finished, otherwise your server will soon use them all up and will be unable to form new connections to the database.
Connection.rollbackTransaction() (Method) A means of undoing transactions that have not yet been committed. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
JavaScript syntax:
NES
myConnection.rollbackTransaction()
Until you commit a transaction on the database, you can rollback to the previous commit state. Once you have committed a transaction, this opportunity to undo is lost. To undo after that, you must make changes under your own script's control. That means that if you anticipate that possibility, you will need to remember the previous values. On the whole, it's easier to let the database do this and to commit only when you are sure the transaction is complete and correct.
Connection.SQLTable() (Method) Create an HTML table as a result of a SQL query on the database. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
Property/method value type:
String primitive
JavaScript syntax:
NES
Argument list:
someSQL
myConnection.SQLTable(someSQL) A string containing valid SQL for the database
The argument to this method is a database query that is expected to yield some rows and columns. These are then reformatted with the requisite HTML tags to form a table. The table is likely to be fairly generic in appearance so you may need to modify the HTML that is returned or perhaps you could use style sheets to control its appearance.
Connection.storedProc() (Method) This method creates a Stproc object and then runs the stored procedure on the database server. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
333
JavaScript Programmer's Reference
JavaScript syntax:
NES
myConnection.storedProc(aProcName)
myConnection.storedProc(aProcName, aProcParm) aProcName The name of a stored procedure to call NES
Argument list:
aProcParm A parameter or parameters to pass to the stored procedure Stored procedures are pre-programmed code that lives inside the database. They generally encompass searches that are more complex than the simple select … from … where … SQL statements. Stored procedures in some database products cannot yield a record structure the same as a select query would. This is because they are not associated with any particular table and so they return the results as a resultset rather than a table record. You may need to do additional work to turn the resultset into the objects you need.
Warnings: Every middle-ware application server supports a completely different way of running stored procedures. At least it seems like that sometimes when you are using several different products. Fundamentally they all do the same thing but databases provide different mechanical implementations and so there are many different ways in which to develop code to exploit them.
❑
See also:
Stproc object
Connection.toString() (Method) Returns a string containing a representation of the Connection object. Availability:
JavaScript – 1.2 Netscape Enterprise Server – 3.0
Property/method value type:
String primitive
JavaScript syntax:
NES
myConnection.toString()
The value of the object is converted to a string value that represents its value.
const (Reserved word) Reserved for future language enhancements. This keyword suggests that future standardization may support immutable constant values. This may allow stronger type casting of formal parameters in function prototypes. See also:
Function prototype, Reserved word, Type, volatile
Cross-references: ECMA 262 edition 2 – section – 7.4.3 ECMA 262 edition 3 – section – 7.5.3
334
C – Constant (Definition)
Constant (Definition) A literal description of a fixed value. A constant is a lexical element that represents a set numerical or string value. Numeric values can be integer or floating-point. String values may define only a single character but are nevertheless still considered to be a string. The Number and Math objects provide constant values as properties of the object class. These are static constants. Other static constants are provided by the implementation. For example the Event object supplies a set of masks in some implementations. These masks can be used to determine keyboard states. The DOM standard defines others as part of the event model. See also:
Character constant, Constant expression, Escape sequence (\), Floating constant, Integer constant, Lexical element, Literal, Math object, Number object, Primary expression, Variable
Cross-references: Wrox Instant JavaScript – page – 13
Constant expression (Definition) A constant expression is a combination of constants and an operator. A constant expression can always be degenerated to a simpler constant form. For example 100 + 101 is a constant expression, but could be replaced by the value 202. A constant expression involving strings is "abcdef" + "ABCDEF". This yields the result "abcdefABCDEF".
Warnings: ❑
In JavaScript you should always try to avoid the use of string concatenation unless you really have to use it. It is very useful. However, in Netscape and MSIE, over-using a string concatenation in a loop can lead to significant memory leaks. It is quite easy to leak several megabytes of memory in a few minutes simply by concatenating strings and passing them to a document.write(). The garbage does eventually get collected, but not until the page is refreshed. This means that a page that implements a ticker for instance can leak horribly until the page is refreshed. There are techniques you can employ to minimize this effect and you could trigger a garbage collection by reloading the page periodically under script control. See also:
Arithmetic constant, Character constant, Constant, Date constant, Escape sequence (\), Expression, Expression statement, Floating constant, Floating-point constant, Initialization, Integer constant, JavaScript language, Logical constant, Object constant
335
JavaScript Programmer's Reference
Constraint (Definition) A restriction placed on a script to be executed. A constraint determines a restriction that the syntax and semantics of the language must set upon the interpretation of the elements of the language. Violating these constraints should generate an interpretation error in a compliant implementation. See also:
Definition, Diagnostic message, Error handling
Construct (Property/internal) An object constructor call. Availability:
ECMAScript edition – 2
The internal constructor is invoked via the new operator. This is not implemented by all objects. Those that do support it are called constructor objects. In other languages these might be called factory objects.
Warnings: The global object does not have a Construct property and you cannot make copies of it with the new operator.
❑
See also:
Constructor function, constructor property, Internal Method
Property attributes: DontEnum.
Cross-references: ECMA 262 edition 2 – section – 15 ECMA 262 edition 3 – section – 15.1.4
Constructor function (Definition) A function that can create new objects. Availability:
ECMAScript edition – 2
A constructor is analogous to a factory class in a truly object-oriented system. It instantiates new objects of its class by copying a built-in prototype object.
336
C – Constructor function (Definition)
A constructor function is a method that creates and initializes new objects or values. It is a way of calling the constructor object as a function rather than with the new operator. These constructor functions are available from the global object; the host implementation may add others for you to use: ❑
Object()
❑
Function()
❑
Array()
❑
String()
❑
Boolean()
❑
Number()
❑
Date()
Calling the constructor as a function is a way of carrying out type conversion. You can also create your own constructor functions. You name them with the name of the class you want to create. Depending on how you implement them, they may or may not work as type converting functions. When we use the new operator, it understands that the function is a constructor and as it constructs the new object, it associates the constructor function with it so you can locate it again, via the prototype and constructor properties. Because this function makes use of the 'this' keyword, it could be a method belonging to another object. However, it doesn't have to belong to an object to be used as a constructor in the first place. The object creation process will properly associate it in due course when it needs to. You don't need to pass parameters to add properties to objects as they are created. Constructors are generally a better way of making self documenting objects than simply instantiating more copies of the Object object. In addition, there is more opportunity to reuse and share code between multiple instances. It's probably not a good thing to add properties and methods to the base Object class as it means they would get inherited just about everywhere, because ultimately all prototype inheritance chains descend from the topmost Object. With a constructor, you can simulate arrays by making them from objects and property components. This may be useful if you want to run an array-based script in a very old JavaScript implementation although these days that likelihood of that is diminishing rapidly. The Netscape browser creates a constructor for virtually every object it instantiates. This can be an aid to debugging and making more flexible scripts. You can inspect an object by requesting its constructor property. This will normally convert to a string that contains the function definition and to determine the class it may be more useful to request the constructor.name property instead. This technique is not so useful in MSIE where constructors are only made available for objects that can genuinely be instantiated usefully by a script.
337
JavaScript Programmer's Reference
Example code: // This constructor function defines a class called Tree: function Tree(aName, aNode1, aNode2) { this.name = aName; this.leftbranch = aNode1; this.rightbranch = aNode2; } // We can now implement tree walking algorithms and // associate them with the prototype for the tree object: function tree_walk() { if((this.leftbranch == null) && (this.rightbranch == null)) { document.write(this.name); document.write("
"); } if(this.leftbranch != null) { document.write(this.name); document.write(" -L- "); this.leftbranch.walk(); } if(this.rightbranch != null) { document.write(this.name); document.write(" -R- "); this.rightbranch.walk(); } } // Now associate the tree walk with the prototype. Tree.prototype.walk = tree_walk; // Here we create a new tree object: // In this case, we have defined null values to signify we have reached // the end of the branching structure so we must be at a leaf node. myTree1 = new Tree("AAA", null, null); // Let's create another and join both to a third: myTree2 = new Tree("BBB", null, null); myTree3 = new Tree("CCC", myTree1, myTree2); // Now we walk the tree myTree3.walk(); // We could have created an array in the tree class and // stored more than two branches. B-Trees, Quad trees, // and Oct trees are all useful modelling tools for // building simulations.
See also:
338
Array simulation, Construct, constructor property, prototype property
C – constructor property (Definition)
Cross-references: ECMA 262 edition 2 – section – 4.3.4 ECMA 262 edition 2 – section – 15.1.3 ECMA 262 edition 3 – section – 4.3.4 Wrox Instant JavaScript – page – 31
constructor property (Definition) A reference to a constructor function. Availability:
ECMAScript edition – 2
A constructor property is a function object that creates and initializes new objects. Each constructor has an associated prototype object that provides inheritance and shared properties. There are constructor properties belonging to the Global object for all the Built-in (Native) object prototypes. These constructors are available as part of the core language from the global object. They are defined in the ECMA standard at editions 2 and 3. The host implementation may add others for you to use: ❑ ❑ ❑ ❑ ❑ ❑ ❑
Object() Function() Array() String() Boolean() Number() Date()
To create new objects, a new expression is formed with the constructor as its operand. The result is to create a new object by means of the constructor. For any object the constructor is a property of the prototype. The prototype is a property of the object and the constructor points back at the object. In that sense the prototype and constructor properties each point at the other's parent object. This needs to hold true for a constructor to be correctly set up: myObject.prototype.constructor is the same as: myObject They should test true with the === operator since they are supposed to be identical objects.
Warnings: ❑
Both Netscape and MSIE support a constructor property for the Math object. You won't find very many circumstances where you will need to create a new instance of the Math object. Note that the constructor is not a Math object but an Object object, therefore a new Math() statement will produce a new Object object and not a new Math object.
339
JavaScript Programmer's Reference
❑
In both cases, attempting to execute a new Math() statement will cause a run-time error. Arguably, this is a bug because objects that should not be instantiated or cloned ought not to support a constructor so that you can sensibly write general-purpose routines that can test for the existence of a constructor property and can then exit gracefully if it is not supported.
❑
The constructor property is supported so inconsistently across the browsers that this kind of test before use approach is almost impossible to deploy. See also:
Construct, Global object, prototype property
Cross-references: ECMA 262 edition 2 – section – 4.3.4 ECMA 262 edition 2 – section – 15.1.3 ECMA 262 edition 3 – section – 4.3.4
constructor.name (Definition) The name of the constructor that created an object. You can determine the class of an object by requesting the name property from its constructor. Since the constructor is a function, you are actually asking a function object for its name. Functions know all about their names. If you get the name of a function that's been used as a constructor, you have effectively gotten its class. Its type is still an object, but its class lets you tell one kind of object from another. See also:
Determining the object type
Content Model (Definition) A new model in the DOM level 3 specification describes how documents can be exchanged between implementations. The DOM level 3 content model is embodied in the following object classes: ❑
CMObject
❑
CMExternalObject
❑
CMNode
❑
CMNodeList
❑
NamedCMNodeMap
❑
CMDataType
❑
CMType
❑
ElementDeclaration
❑
ElementCMModel
❑
AttributeDeclaration
❑
EntityDeclaration
340
C – contextual() (Method)
❑
DocumentCM
❑
DomImplementationCM
❑
ErrorHandler
❑
NodeCM
❑
TextCM
contextual() (Method) A JSS style control method. Availability:
JavaScript – 3.0 Netscape – 4.0 Deprecated
JavaScript syntax:
N
Argument list:
contextual(tags.anItem, ...).aProperty = aValue
anItem
A tag name such as P or B or H1
aProperty A style property of the returned tags object aValue A value to be stored in the property of the nominated tags This function can take a variable number of arguments, each one indicating a tag property within the tag's object. It is followed by a dot-delimited property value and basically provides a way to modify the same property across a large number of objects in a single call. This could be a quite useful function for a variety of other non-style-related cases. You may want to experiment and see whether, in your browser, the contextual() method is useful. However, it may only be present in Netscape browsers, thus limiting its usefulness for deployment. When used in a JSS context, this is more or less equivalent to H1 P { color: red }.
Warnings: ❑
This functionality is removed from Netscape 6.0.
Example code: // Set the color property for several objects at once. contextual(tags.P, tags.H1)color = "red";
See also:
JavaScript Style Sheets
Cross-references: Wrox Instant JavaScript – page – 50
341
JavaScript Programmer's Reference
continue (Statement) Force the next iteration of a loop. Availability:
JavaScript syntax:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.0 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0 continue aLabelName; -
Argument list:
continue;
aLabelName
The name of a label associated with some code
The continue keyword is a jump statement. It is used in an iterator loop to proceed to the next cycle without executing the remaining lines in the statement block. A continue statement can only legally exist inside a while or for loop in an ECMA-compliant implementation. Implementations that provide additional iterator types may also honor the same behavior for the continue statement. The continue statement would normally be executed conditionally, otherwise it would cause the remaining lines to be redundant since no execution flow would ever reach them. Compilers generally warn you about this, but JavaScript would likely simply ignore it. The continue statement is obeyed by the smallest enclosing iterator loop. At version 1.2 of JavaScript, the continue statement was enhanced to support a label as a continuing destination. When the continue is processed, it will jump to the start of the statement that has been labeled. If an iterator is labeled, then the continue is associated with that iterator. This mechanism can only be used in a while, for or for ... in loop. A labeled continue behaves differently according to the iterator it has been used in.
Warnings: ❑
In Netscape 4, there is a bug with labeled continue statements and do ... while loops that causes the continue to vector to the top of the loop without testing the condition. This can set up an endless loop. You could work round this by creating a while loop and modifying the test condition.
❑
When the continue statement is used, its behavior inside a while loop suggests that a while loop is not exactly similar to a for loop. In a while loop, it simply runs the test condition again before deciding to loop or not. In a for loop, the incrementor gets executed again and then the test condition. You cannot perfectly simulate a for loop with a while loop if a continue statement is involved. See also:
342
break, Completion type, do ... while( ... ), for( ... ) ..., for( ... in ... ) ..., Iteration statement, Jump statement, Label, return, Scope chain, Statement, while( ... ) ...
C – Control character (Definition)
Cross-references: ECMA 262 edition 2 – section – 10.1.4 ECMA 262 edition 2 – section – 12.7 ECMA 262 edition 3 – section – 10.1.4 ECMA 262 edition 3 – section – 12.7 Wrox Instant JavaScript – page – 25
Control character (Definition) A non-printing character entity. A control character is any character code point in the locale-specific character set that does not print a visible glyph when it is output. See also:
ASCII, Character handling, isCtrl(), isGraph(), isPrint(), Printing character, Unicode
Conversion (Definition) Changing the type of a value, object, function or constant. Values are continuously being changed from one type of value to another inside a JavaScript interpreter. The very nature of its weak data typing and the automatic promotion and demotion of values in expressions causes implicit changes in the type of values at almost every step of a script's execution. The conversion behavior of each type is discussed in the coverage of each of the Native primitive types that are built into the interpreter. Refer to the Cast operator description as well for further information. There are also some internal conversion operators that provide the basic underlying conversion facilities. These are described in the following topics: ❑
ToBoolean
❑
ToInt32
❑
ToInteger
❑
ToNumber
❑
ToObject
❑
ToPrimitive
❑
ToString
❑
toString()
❑
ToUint16
❑
ToUint32
343
JavaScript Programmer's Reference
These are given individual topics on account of their description in the ECMA standard. There are however four basic and fundamental conversions. These are: ❑
Boolean
❑
Number
❑
String
❑
Object
The internal function topics cover what happens inside an interpreter. In this topic and the several following, we are concerned with the script visible effects of conversion. There are some circumstances where the conversion of an object to a number or a string can be ambiguous. The cases of concatenate or add and the relative expression operators are such an example. The Date objects will prefer to be converted to a string rather than a number if at all possible and consistent with the context. Many objects have toString() methods. Not as many will support the valueOf() method. The valueOf() method is so named because it is not implicitly a toNumber() method. It may return a string because that is the most reasonable primitive. It is really a toPrimitive() method. See also:
Argument, Cast operator, Integer constant, Integer promotion, LValue, ToBoolean, ToInt32, ToInteger, ToNumber, ToObject, ToPrimitive, ToString, toString(), ToUint16, ToUint32
Conversion to a Boolean (Definition) Converting values to a Boolean representation. There are three conversions to study. Obviously Boolean values will remain as they are. This table summarizes the effects of converting values to Boolean: Value:
Boolean equivalent:
null Undefined value Non empty string Empty string 0 NaN Infinity Negative infinity Any other non zero number Object Array Function
false false true false false false true true true true
344
No direct boolean equivalent true
C – Conversion to a number (Definition)
There is no proper Boolean equivalent for an array. The ECMA standard does not address this either. The standard does suggest that any non-null object reference convert to true and since an array is an object, it should rightly become a true value.
Warnings: ❑
Some non-portable behavior has been implemented in the MSIE and Netscape browsers. In some cases, the array becomes true in all cases. In others, a non-empty array is true, while an empty array is false. This seems to be based on the length value.
❑
You should test your target browsers to see what behavior persists if you intend to use this capability and not rely on any implicit array conversion facilities. It is probably safest to implement your own conversion method.
❑
The array to Boolean conversion is so inconsistently supported as to render it unusable in any crossbrowser implementation.
❑
A more insidious side effect is exhibited by the fact that all objects convert to the Boolean true value, even a Boolean object whose value is false. This is demonstrated in the example. You really need to be careful if you are storing Boolean values in objects rather than simple variables, especially if they are driving some conditional code execution.
Example code: <SCRIPT> window.myDate1 = new Date(); 0000 <SCRIPT> function clickMe() { myDate2 = new Date();
383
JavaScript Programmer's Reference
myDelta = myDate2 - window.myDate1; document.all.TEXTCELL.innerText = myDelta/1000; }
See also:
Property
Broken down time, Browser version compatibility, Calendar time, Compatibility strategies, Date.Class, Date.length, Date.prototype, Event.timeStamp, java.util.Date, JellyScript, MakeDate(), MakeDay(), MakeTime(), Native object, Object object, Time range, Time value, TimeClip(), unwatch(), watch()
JavaScript
JScript
N
IE
Opera
NES
ECMA
Notes
constructor
1.1 +
1.0 +
3.0 +
3.02 +
-
-
2+
-
length
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
ReadOnly, DontEnum.
prototype
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
2.0 +
2+
ReadOnly, DontDelete, DontEnum.
Method
JavaScript
JScript
N
IE
Opera
NES
ECMA
Notes
getDate()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
getDay()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
getFullYear()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
getHours()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
getMilliseconds()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
getMinutes()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
getMonth()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
getSeconds()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
getTime()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
getTimezoneOffset()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
Warning
getUTCDate()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
getUTCDay()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
getUTCFullYear()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
Warning
getUTCHours()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
getUTCMilliseconds()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
getUTCMinutes()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
getUTCMonth()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
getUTCSeconds()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
getVarDate()
-
3.0 +
-
4.0 +
-
-
-
-
getYear()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
Warning, Deprecated
Table continued on following page
384
D – Date object (Object/core)
Method
JavaScript
JScript
N
IE
Opera
NES
ECMA
Notes
parse()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
setDate()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
setFullYear()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
setHours()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
setMilliseconds()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
setMinutes()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
setMonth()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
setSeconds()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
setTime()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
setUTCDate()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
setUTCFullYear()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
setUTCHours()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
setUTCMilliseconds()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
setUTCMinutes()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
setUTCMonth()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
setUTCSeconds()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
setYear()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
Warning, Deprecated
toDateString()
1.5 +
5.5 +
6.0 +
5.5 +
-
-
3+
-
toGMTString()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
Warning, Deprecated
toLocaleDateString()
1.5 +
5.5 +
6.0 +
5.5 +
-
-
3+
-
toLocaleString()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
-
toLocaleTimeString()
1.5 +
5.5 +
6.0 +
5.5 +
-
-
3+
-
toSource()
1.3 +
3.0 +
4.06 + 4.0 +
-
-
3+
-
toString()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
2.0 +
2+
Warning
toTimeString()
1.5 +
5.5 +
6.0 +
5.5 +
-
-
3+
-
toUTCString()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
2+
-
valueOf()
1.1 +
3.0 +
3.0 +
4.0 +
-
-
2+
-
Cross-references: ECMA 262 edition 2 – section – 10.1.5 ECMA 262 edition 2 – section – 15.9 ECMA 262 edition 2 – section – 15.9.6 ECMA 262 edition 3 – section – 10.1.5 ECMA 262 edition 3 – section – 15.9 O'Reilly JavaScript Definitive Guide – page – 48
385
JavaScript Programmer's Reference
Date() (Constructor) A Date object constructor. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0
Property/method value type:
Date object
JavaScript syntax:
-
new Date()
-
new Date(aValue)
-
new Date(aYear, aMonth)
-
new Date(aYear, aMonth, aDate)
-
new Date(aYear, aMonth, aDate, anHour)
-
new Date(aYear, aMonth, aDate, anHour, aMinute) new Date(aYear, aMonth, aDate, anHour, aMinute, aSecond) new Date(aYear, aMonth, aDate, anHour, aMinute, aSecond, aMillisecond)
JavaScript syntax:
Argument list:
aDate
An optional date within the month value
aMillisecond
An optional value between 0 and 999 milliseconds
aMinute
An optional value between 0 and 59 minutes
aMonth
An optional 0 to 11 month value
anHour
A value between 0 and 23 hours
aSecond
An optional value between 0 and 59 seconds
aYear
A full year value
aValue
A time in UTC milliseconds
The result of calling this constructor is a date object with the indicated date and time value. Calling the Date() constructor with the new operator creates a fresh object based on the Date prototype. The value of this new Date object depends on the parameters specified when the constructor was invoked. This is not the same as simply calling the Date() function which would yield the current system date and time at the instant it was called. The arguments to the Date() constructor are all optional, but they are also positional. This means that you must mark empty positions with comma separated null values to indicate that a parameter needs to be skipped. The time values are assumed to be measured in local time and not UTC. The prototype of the new Date object is the built in Date prototype object.
386
D – Date() (Constructor)
Functionally, the algorithm that manufactures a new date value uses the internal MakeDay(), MakeTime(), and MakeDate() functions that we describe elsewhere. If the year value is less than 99, then the date creation adds 1900 to it and assumes the date is in the 20th century. To avoid millennium problems, always specify a full year number. The following rules apply where items are omitted from the right of the argument list. Zero values are assumed for hours, minutes and seconds. When all three are missing, the time is assumed to be midnight. The date value is assumed to be the first of the month, and the default month is not considered since a single value on its own is taken to mean a millisecond time value in UTC time coordinates. When all arguments are omitted, the time value for the new object is set to the current time in UTC time coordinates. Putting null values in place of the year month and date sets the time correctly but unpredictable date values are substituted.
Example code: <SCRIPT> // Define the date but assume the time is set to zero // Note that month numbers start at zero myDate1 = new Date(1954, 0, 19); document.write(myDate1); document.write("
"); // Define the time in minutes but make up any old date myDate2 = new Date(null, null, null, 12, 14); document.write(myDate2); document.write("
"); // Fully qualified date value myDate3 = new Date(1984, 9, 23, 1, 0, 0, 0); document.write(myDate3); document.write("
"); // Output message of the day
See also:
Constructor function, constructor property, Date constant, Date()function, Date.UTC(), Global object, MakeDate(), MakeDay(), MakeTime(), new, Object constant, TimeClip()
387
JavaScript Programmer's Reference
Cross-references: ECMA 262 edition 2 – section – 15.1.3.7 ECMA 262 edition 2 – section – 15.9.3 ECMA 262 edition 2 – section – 15.9.4 ECMA 262 edition 3 – section – 15.9.3
Date() (Function) A function that returns the current date. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0
Property/method value type:
String primitive
JavaScript syntax:
-
Date()
This function returns a string primitive representing the current UTC time value. When the Date() constructor is called as a function rather than in a new expression, it returns a string representing the current time (in UTC time). Note that when calling it as a function the arguments are all ignored and it is not equivalent to calling the Date() constructor in a new expression at all. Effectively, the function call to a Date() constructor behaves as if you had coded this fragment of JavaScript in the script source text: (new Date()).toString() See also:
Cast operator, Constructor function, constructor property, Date constant, Date() constructor, Implicit conversion
Cross-references: ECMA 262 edition 2 – section – 15.1.3.7 ECMA 262 edition 2 – section – 15.9.2 ECMA 262 edition 3 – section – 15.9.2
Date.Class (Property/internal) Internal property that returns an object class. Availability:
388
ECMAScript edition – 2
D – Date.constructor (Property)
This is an internal property that describes the class that a Date object instance is a member of. The reserved words suggest that, in the future, this property may be externalized. See also:
Class, Date object
Property attributes: DontEnum, Internal.
Cross-references: ECMA 262 edition 2 – section – 8.6.2 ECMA 262 edition 2 – section – 15.9.3.1 ECMA 262 edition 3 – section – 8.6.2
Date.constructor (Property) A reference to a constructor object. Availability:
ECMAScript edition – 2 JavaScript – 1.1 JScript – 1.0 Internet Explorer – 3.02 Netscape – 3.0
Property/method value type:
Date constructor object
JavaScript syntax:
-
Date.constructor
The initial value of the date prototype constructor is the built-in Date constructor. You can use this as one way of creating Date objects although it is more popular to use the new Date() technique. This property is useful if you have an object that you want to clone but you don't know what sort of object it is. Simply access the constructor belonging to the object you have a reference to. Netscape provides constructors for many objects, virtually all of them in fact, even when it is highly inappropriate to do so. MSIE is far more selective and there are some occasions when you might wish for a constructor that MSIE does not make available. See also:
Date constant, Date.length, Date.parse(), Date.prototype, Date.UTC()
Cross-references: ECMA 262 edition 2 – section – 15.9.5.1 ECMA 262 edition 3 – section – 15.9.3
389
JavaScript Programmer's Reference
Date.getDate() (Method) Returns the day number within a month for a date/time. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myDate.getDate()
This method returns a day number within a month from the date value of the receiving object. The value is 1 based and will not exceed 31 although the range is variable based on month and leap year contexts. The date is computed according to local time coordinates.
Example code: <SCRIPT> // Create diary of special days per month myDiary = new Array(); myDiary[1] = "Pay into bank account"; myDiary[28] = "Invoice customers"; myDiary[14] = "Chase customers for payment"; myDiary[5] = "Top up fuel in generator"; // Work out day number myDate = new Date(); myDay = myDate.getDate(); // Output message of the day document.write(myDiary[myDay]);
See also:
Date.prototype, Date.setDate()
Cross-references: ECMA 262 edition 2 – section – 15.9.5.10 ECMA 262 edition 3 – section – 15.9.5.14
390
D – Date.getDay() (Method)
Date.getDay() (Method) Returns the weekday number for a date/time. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myDate.getDay()
A weekday number for the date value of the receiving object is returned. The value will be in the range 0 to 6, with 0 representing Sunday. The value is computed according to Local time coordinates.
Example code: <SCRIPT> myArray = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); myDate = new Date(); document.write(myArray[myDate.getDay()]);
See also:
Date.prototype
Cross-references: ECMA 262 edition 2 – section – 15.9.5.12 ECMA 262 edition 3 – section – 15.9.5.16
391
JavaScript Programmer's Reference
Date.getFullYear() (Method) Returns the full year for a date/time. Availability:
ECMAScript edition – 2 JavaScript – 1.3 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myDate.getFullYear()
The full year number of the date value in the receiving object is returned as a four digit value. This is much preferred to the getYear() method which suffers from Y2K ambiguities and is now deprecated in favor of this method. The year number is a local time value.
Example code: <SCRIPT> // Calculate which century from the year number myDate = new Date(); myCentury = 1 + myDate.getFullYear()/100; switch (myCentury % 10) { case 1 : mySuffix = "st"; break; case 2 : mySuffix = "nd"; break; case 3 : mySuffix = "rd"; break; default : mySuffix = "th"; break; } document.write(myCentury + mySuffix + " century");
See also:
Date.getYear(), Date.prototype, Date.setFullYear(), Date.setUTCFullYear(), Date.setYear()
Cross-references: ECMA 262 edition 2 – section – 15.9.5.6 ECMA 262 edition 3 – section – 15.9.5.10
392
D – Date.getHours() (Method)
Date.getHours() (Method) Returns the hour value for a date/time. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myDate.getHours()
The hours of the time value contained in the receiving object. This is returned as an integer in the range 0 to 23 inclusive. The value is computed according to local time coordinates.
Example code: <SCRIPT> // Generate a flag based on work or play time myDate = new Date(); myHours = myDate.getHours(); if((myHours > 8) && (myHours < 17)) { document.write("At work"); } else { document.write("At play"); }
See also:
Date.prototype, Date.setHours(), Date.setUTCHours()
Cross-references: ECMA 262 edition 2 – section – 15.9.5.14 ECMA 262 edition 3 – section – 15.9.5.18
393
JavaScript Programmer's Reference
Date.getMilliseconds() (Method) Return the milliseconds value of a date/time. Availability:
ECMAScript edition – 2 JavaScript – 1.2 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myDate.getMilliseconds()
The milliseconds of the time value contained in the receiving object. The result will be an integer in the range 0 to 999 inclusive. The value is computed according to local time coordinates. In the example a timer is set up to trigger a function call every 1000 milliseconds. However, processing load may affect how accurately the timer is executed. By measuring the time on each call, we know that the millisecond value should be the same each time but you will probably observe a small and random perturbation in the value. You can compensate for this by making a small adjustment to the timer value to take this error into account. You will most likely need to reduce the value 1000 by a few milliseconds to get a more accurate timer.
Example code: 000 <SCRIPT> // Check the accuracy of a timer by printing the milliseconds setInterval("monitor()", 1000); myOldMSecs = 000; function monitor() { myDate = new Date(); myMsecs = myDate.getMilliseconds(); myErr = myMsecs - myOldMSecs; document.all.RESULT.innerText = myMsecs + " (" + myErr + " milliseconds of error)"; myOldMSecs = myMsecs; }
See also:
394
Date.prototype, Date.setMilliseconds(), Date.setUTCMilliseconds()
D – Date.getMinutes() (Method)
Cross-references: ECMA 262 edition 2 – section – 15.9.5.20 ECMA 262 edition 3 – section – 15.9.5.24
Date.getMinutes() (Method) Returns the minutes value of a date/time. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myDate.getMinutes()
The minutes of the time value contained in the receiving object. The result will be an integer in the range 0 to 59 inclusive. The value is computed according to local time coordinates.
Example code:
<SCRIPT> setBar() setInterval("setBar()", 990); function setBar() { myDate = new Date(); mySeconds = myDate.getSeconds(); myOther = 60 - mySeconds; document.all.LEFT.style.width = 1+mySeconds*10; document.all.RIGHT.style.width = 1+myOther*10; }
See also:
Date.prototype, Date.setSeconds(), Date.setUTCSeconds()
Cross-references: ECMA 262 edition 2 – section – 15.9.5.18 ECMA 262 edition 3 – section – 15.9.5.22
Date.getTime() (Method) Returns the time value of a date/time. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Time value
JavaScript syntax:
-
myDate.getTime()
The time value of the receiving object. This will be an integer that represents the time in milliseconds since the time origin at midnight on January the first, 1970. This method returns the time value of the receiving object.
398
D – Date.getTimezoneOffset() (Method)
Example code:
<SCRIPT> setBar() setInterval("setBar()", 60000); function setBar() { myDate = new Date(); myMinutes = myDate.getUTCMinutes(); myOther = 60 - myMinutes; document.all.LEFT.style.width = 1+myMinutes*10; document.all.RIGHT.style.width = 1+myOther*10; }
See also:
Date.prototype, Date.setUTCMinutes()
Cross-references: ECMA 262 edition 2 – section – 15.9.5.17 ECMA 262 edition 3 – section – 15.9.5.21
406
D – Date.getUTCMonth() (Method)
Date.getUTCMonth() (Method) Returns the UTC month number for a date/time. Availability:
ECMAScript edition – 2 JavaScript – 1.3 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myDate.getUTCMonth()
The result of this method is month number for the receiving date object. The value will be in the range 0 to 11 inclusive, with the value 0 representing January, and 11 representing December. The month number is measured in UTC time coordinates.
Example code: <SCRIPT> myDate = new Date(); myMonth = myDate.getUTCMonth(); egyptianSeasons(myMonth); // Generate attributes of the egyptian calendar based on month function egyptianSeasons(aMonth) { mySeasonArray = new Array("Akhet", "Peret", "Shemu"); myMonthArray = new Array("I", "II", "III", "IV"); mySeason = mySeasonArray[Math.floor(aMonth/4)]; myMonth = myMonthArray[aMonth%4]; document.write("Index : " + aMonth + "
"); document.write("Season : " + mySeason + "
"); document.write("Month : " + myMonth + "
"); }
See also:
Date.prototype, Date.setUTCMonth()
Cross-references: ECMA 262 edition 2 – section – 15.5.9.9 ECMA 262 edition 3 – section – 15.9.5.13
407
JavaScript Programmer's Reference
Date.getUTCSeconds() (Method) Returns the UTC seconds value for a date/time. Availability:
ECMAScript edition – 2 JavaScript – 1.3 JScript – 3.0 Internet Explorer – 4.0 Netscape – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myDate.getUTCSeconds()
The result of this method is the seconds part of the time value contained in the receiving object. The value will be in the range 0 to 59 inclusive. The value is computed according to UTC time coordinates.
Example code: <SCRIPT LANGUAGE="JavaScript"> // Write text into the document body at this point document.write('Your text here'); // Present a dialog box with a message alert('Your other text here'); --------------------------------------------------------------
See also:
COMMENT object, Pitfalls
Cross-references: Wrox Instant JavaScript - page 46
Hierarchy of objects (Definition) To fully understand JavaScript and in particular its use in the browser, it is helpful to know how objects relate to one another. In the core JavaScript language, objects are related to one another by means of the prototype chain. This is a hierarchy that determines the inheritance of functionality from a super-class, although it's an object-based inheritance and not really a class-based inheritance. You can only walk up this hierarchy. There is no convenient way to determine what objects are sub-classed from an object. From version 5.0 of MSIE and version 6.0 of Netscape, there are several hierarchy models available for traversing the document. The HTML view of the document is not quite the same as the DOM view. In general, each one is based on a property to traverse up the tree to a parent and collections for traversing down the tree to the leaf nodes. Here are some examples of the different hierarchical arrangements. ❑
The parentElement and children[] collection operate on the HTML tag-based hierarchy.
❑
The parentNode property and childNodes[] collection can be used to traverse the DOM hierarchy which exposes the interstitial text objects between the HTML tags. These are not visible to the HTML view.
❑
The spatial layout and positioning of objects relative to one another can be walked upwards by means of the offsetParent property. You can't traverse this tree from top to bottom without inspecting the contents of the children[] collection and looking at each child's offsetX and offsetY properties.
1022
H – Hierarchy of objects (Definition)
❑
The all[] collection flattens the whole tree from the receiving object downwards. The document.all[] collection is the complete tree. This can slow things down if you are searching it to find a single object.
❑
An editing hierarchy is constructed with the parentTextEdit property which describes the relationship between items that can have a text range created for them, and hence have some selectable content that can be cut or copied to the clipboard (usually as text).
❑
Function calls construct a hierarchy by means of the Argument objects which link upwards to the calling function's Arguments object. This provides a way to walk through a stack trace to diagnose a calling sequence.
❑
You can create custom hierarchies by using nested tags and navigating them by means of the corresponding DIV objects they instantiate.
❑
A spatial hierarchy is created in Netscape version 4 with the tags. Layers sharing a common parent are siblings and can be ordered relative to one another.
❑
A CSS style hierarchy is implemented in MSIE to describe the relationship between CSS style rule objects and their owning parent style sheet.
❑
Another hierarchy can be built by importing style sheets into one another to allow styles to be managed in a more modular fashion. This is also supported at the rule level by means of the styleSheet.addRule() method.
The DOM level 2 standard adds a suite of traversal methods for walking through a document object model. It is embodied in the following classes: ❑
NodeIterator
❑
NodeFilter
❑
TreeWalker
❑
DocumentTraversal
Related to the traversal suite, the DOM level 2 standard also introduces the Range suite. This is embodied in these classes: ❑
Range
❑
DocumentRange
❑
RangeException See also:
Arguments.caller, ChildNodes object, DIV object, Document.createTextNode(), Element.all[], Element.childNodes[], Element.children[], Element.offsetParent, Element.ownerDocument, Element.parentElement, Element.parentNode, Element.parentTextEdit, Layer.siblingAbove, Prototype Based Inheritance, rule.parentStyleSheet, StyleSheet.addImport(), StyleSheet.addRule(), StyleSheet.owningElement, StyleSheet.owningNode, StyleSheet.parentStyleSheet
1023
JavaScript Programmer's Reference
High order bit (Definition) The most significant bit in an integer value.
1
See also:
1
1
1
1
0
0
0
Bit, Bit-field, Bitwise operator, byte
History (Background) Scripting language history. Availability:
ECMAScript edition - 2
The JavaScript language was invented by Brendan Eich at Netscape. In the early days, it was known as LiveScript. The ECMA 262 standard is based on the earlier work at Netscape where they embedded the JavaScript interpreter into the Netscape version 2.0 web browser. Microsoft also embedded scriptdriven capabilities into their version 3.0 of the MSIE browser. The Microsoft interpreter implements a language called JScript as opposed to JavaScript. Microsoft clearly chose not to use the word JavaScript. It might be because any product name containing the word 'Java' needs to be licensed from Sun Microsystems or that it was a Netscape originated name. Given the very public antagonism between Microsoft and the other two, this is understandable. Perhaps it also gives Microsoft a little extra leeway to extend the language in non-standard ways. Both Microsoft and Netscape have continued to enhance their implementations in subsequent versions of their web browsers, taking them sometimes in completely opposing directions. In November 1996, the language started to become standardized by a working group under the ECMA organization. At this stage it was also commonly referred to as ECMAScript and became a published standard in June 1997. By April 1998, the ECMA 262 standard had been adopted as an international standard as ISO/IEC 16262 which prompted a second edition of the ECMA standard to keep the two fully aligned. A third edition of the ECMA 262 standard was published in October 1999. On the horizon are upgraded interpreters from Netscape and Microsoft, and the availability of JavaScript in a variety of other products such as TV set-top boxes, mobile phones and embeddings into legacy applications. See also:
1024
JavaScript language, JavaScript version, JScript version
H – history (Property)
Cross-references: ECMA 262 edition 2 - section Introduction ECMA 262 edition 3 - section Introduction Wrox Instant JavaScript - page 3
history (Property) An alias to the window.history property. Availability:
JavaScript - 1.1 JScript - 3.0 Internet Explorer - 4.0 Netscape - 3.0 Opera - 3.0
Property/method value type:
History object
JavaScript syntax:
-
history myWindow.history
Property attributes: ReadOnly.
Refer to: Window.history
History object (Object/browser) A history object owned by the window. This exposes information about URLs that have been visited previously. Availability:
JavaScript syntax:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0 -
myHistory = history
-
myHistory = myWindow.history
Object properties:
current, length, next, previous
Object methods:
back(), forward(), go()
1025
JavaScript Programmer's Reference
Netscape version 4 provides access to the history array by signed scripts. Earlier versions of Netscape and MSIE do not provide this level of access and therefore the history object is limited in what you can do with it. Some properties can be accessed by non-privileged scripts. In Netscape, each element in the History object array is a String containing the URL for that item in the history. In MSIE, the objects are not accessible directly.
Warnings: ❑
The array elements and properties of this object cannot be accessed by JavaScript unless the script has the UniversalBrowserRead privilege granted to it.
❑
On Netscape, the toString() method is not correctly implemented and returns the value "[object]" instead of "[object History]". Collection object, UniversalBrowserAccess, UniversalBrowserRead, Window.history
See also:
Property
JavaScript
JScript
N
IE
Opera
HTML
Notes
current
1.1 +
-
3.0 +
-
3.0 +
-
Warning, ReadOnly.
length
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
ReadOnly.
next
1.1 +
-
3.0 +
-
3.0 +
-
Warning, ReadOnly.
previous
1.1 +
-
3.0 +
-
3.0 +
-
Warning, ReadOnly.
Method
JavaScript
JScript
N
IE
Opera
HTML
Notes
back()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
forward()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
go()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
Warning
History.back() (Method) Go to the previous page. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
JavaScript syntax:
-
This is accessible to unsigned scripts. See also:
1026
Window.back()
myHistory.back()
H – History.current (Property)
History.current (Property) The URL of the current window content. Availability:
JavaScript - 1.1 Netscape Navigator - 3.0 Opera browser - 3.0
Property/method value type:
String primitive
JavaScript syntax:
N
myHistory.current
If you are accessing the URL of the current page, it is probably better to use the location object and access its href property.
Warnings: ❑
The UniversalBrowserRead privilege is required to access this property value. See also:
UniversalBrowserRead
Property attributes: ReadOnly.
History.forward() (Method) Go to the next page. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
JavaScript syntax:
-
myHistory.forward()
This is accessible to unsigned scripts. See also:
Window.forward()
1027
JavaScript Programmer's Reference
History.go() (Method) Return to a URL from the history array. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera browser - 3.0
JavaScript syntax:
-
myHistory.go(anIndex)
-
myHistory.go(aURL)
anIndex
myHistory.go(aDocTitle)
aURL
A URL value to go to
aDocTitle
The name of a document (in Netscape)
Argument list:
Denotes which history item to go to
You can perform a soft reload of a page, retaining its current settings by means of the History.go(0) method call. The following values are meaningful as an argument: ❑
-4 indicates you want to go back 4 pages.
❑
-1 indicates you want to go back one page.
❑
0 requests a reload of the current page
❑
2 indicates you want to go forward two pages
❑
A URL indicates a specific page to load
❑
A Document title references the history list associatively
Warnings: ❑
There are some bugs in this method in versions of Netscape prior to version 4. MSIE version 3 also exhibits unruly behavior.
Example code: // Recall a page from the history keeping form settings intact history.go(-1);
See also:
1028
Location.reload()
H – History.length (Property)
History.length (Property) The number of history entries available. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myHistory.length
Property attributes: ReadOnly.
Refer to: Collection.length
History.next (Property) The next document in the history array. Availability:
JavaScript - 1.1 Netscape - 3.0 Opera - 3.0
Property/method value type:
String primitive
JavaScript syntax:
N
myHistory.next
The value you get back from this property will depend very much on what navigation the user has recently performed. Most of the time this would yield a null or undefined value unless the user has used the [BACK] button.
Warnings: ❑
The UniversalBrowserRead privilege is required to access this property value.
❑
This property is not supported on the WebTV platform. See also:
JellyScript, UniversalPreferencesRead
Property attributes: ReadOnly.
1029
JavaScript Programmer's Reference
History.previous (Property) The previous document in the history array. Availability:
JavaScript - 1.1 Netscape - 3.0 Opera - 3.0
Property/method value type:
String primitive
JavaScript syntax:
N
myHistory.previous
You may find it more useful to build a stack of pages visited in a persistent array. This can be tricky within a single window, but if you are prepared to use a frameset, you can create a global session store for such things. That way you'd be able to traverse a logical history rather than the possibly random page ordering that the user navigated.
Warnings: ❑
The UniversalBrowserRead privilege is required to access this property value. See also:
UniversalPreferencesRead
Property attributes: ReadOnly.
H object (Object/HTML) An object that represents the to tags. Availability:
DOM level - 1 JavaScript - 1.5 JScript - 3.0 Internet Explorer - 4.0 Netscape - 6.0
Inherits from:
Element object
JavaScript syntax:
IE
myH1 = myDocument.all.anElementID
IE
myH1 = myDocument.all.tags("H1")[anIndex]
IE
myH1 = myDocument.all[aName]
-
myH1 = myDocument.getElementById(anElementID) myH1 = myDocument.getElementsByName (aName)[anIndex] myH1 = myDocument.getElementsByTagName ("H1")[anIndex]
-
1030
H – H object (Object/HTML)
HTML syntax: Argument list:
... , ... , ... , ... , ... , ... anIndex A reference to an element in a collection aName
An associative array reference
anElementID
The ID value of an Element object
Object properties:
align
Event handlers:
onClick, onDblClick, onDragStart, onFilterChange, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onSelectStart
The properties, methods, collections and event handling support for the tag object are also provided for through tag objects as well. It is only necessary to document one of these object classes, although the other header types are each instantiated as objects of an appropriately named class in MSIE. The syntax examples illustrate the use of an tag object. The through tags are block-level tags. That means that they force a line break before and after themselves. The DOM level 1 specification refers to this and its sibling object types as a HeadingElement object. See also:
Element object
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
align
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
-
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick onDblClick onDragStart onFilterChange onHelp onKeyDown onKeyPress onKeyUp onMouseDown onMouseMove onMouseOut onMouseOver onMouseUp onSelectStart
1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + -
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 +
6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + -
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 +
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + -
-
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + -
Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning -
Inheritance chain: Element object, Node object
1031
JavaScript Programmer's Reference
H.align (Property) The alignment of an to tag. Availability:
DOM level - 1 JavaScript - 1.5 JScript - 3.0 Internet Explorer - 4.0 Netscape - 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myH1.align
The alignment of the H1 (to H6) object with respect to its containing parent object is defined in this property. The following set of alignment specifiers are available: ❑
absbottom
❑
absmiddle
❑
baseline
❑
bottom
❑
center
❑
left
❑
middle
❑
right
❑
texttop
❑
top
home() (Method) Go to the home page according to the user preferences. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
undefined
JavaScript syntax:
Refer to: Window.home()
1032
N N
home() myWindow.home()
H – Host environment (Definition)
Host environment (Definition) The environment in which a JavaScript interpreter has been embedded. The host environment is where the JavaScript interpreter lives. Typically this might be a web browser, a web server back end, or an embedded implementation. There are other possibilities as well, limited only by the imagination of the software developers and their ingenuity in finding new ways to apply JavaScript. JavaScript is usually interpreted. However, recent digital TV systems are deploying byte code compiled JavaScript and it is also being used in that way for mobile devices. See also:
<SCRIPT>, argc parameter, argv parameter, CGI Driven JavaScript, Desktop JavaScript, Embedded JavaScript, Environment, Execution environment, File extensions, Glue code, Host features, Implementation-defined behavior, main() function, PDF, Platform, Script execution, Shell Scripting with JavaScript, Web browser, WScript
Cross-references: Wrox Instant JavaScript - page 5 Wrox Instant JavaScript - page 42
Host features (Definition) That which is added to the language due to the hosting environment it runs in. Host features are those which the implementation adds around the native feature set. Host features would include new object types. There are entire groups of objects which collected together provide a host environment capability. For example, the HTML Document Object Model describes a page as it lives inside a web browser. The PDF file format can contain a collection of objects and the PDF reader adds others to construct a different kind of object model. A process control system might contain an object model representation of a brewery or a nuclear reactor, although it is unlikely you would control either with just a JavaScript interpreter. You could build a monitoring system with a mimic display that was a fairly good illustration of the processes though. The browser, server or operating system is said to host the interpreter. That is where the terminology of host environments, host features and so on is derived. See also:
ECMAScript, Host environment
1033
JavaScript Programmer's Reference
Cross-references: Wrox Instant JavaScript - page 12 Wrox Instant JavaScript - page 42
Host object (Definition) An object that is built-in, but is provided by the hosting environment. Availability:
ECMAScript edition - 2
A host object is any additional non-native object provided by the interpreter at the outset of script execution. Host objects may or may not strictly honor the intent of the Get and Put internal function. The ECMA standard allows for the possibility that a host object may still properly manage Get and Put internal functions, even if the HasProperty function returns false for the properties being accessed. See also:
argv parameter, for( ... in ... ) ..., HasProperty(), Implementation-defined behavior, main() function
Cross-references: ECMA 262 edition 2 - section 4.3.8 ECMA 262 edition 3 - section 4.3.8
HR object (Object/HTML) An object that represents an tag. Availability:
DOM level - 1 JavaScript - 1.5 JScript - 3.0 Internet Explorer - 4.0 Netscape - 6.0
Inherits from:
Element object
JavaScript syntax:
IE
myHR = myDocument.all.anElementID
IE
myHR = myDocument.all.tags("HR")[anIndex]
IE
myHR = myDocument.all[aName]
-
myHR = myDocument.getElementById(anElementID)
-
myHR = myDocument.getElementsByName(aName)[anIndex]
-
myHR = myDocument.getElementsByTagName("HR")[anIndex]
HTML syntax:
1034
H – HR object (Object/HTML)
Argument list:
anIndex
A reference to an element in a collection
aName
An associative array reference
anElementID
The ID value of an Element object
Object properties:
align, color, noShade, size, width
Event handlers:
onClick, onDblClick, onDragStart, onFilterChange, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onSelectStart
The tag is a block-level tag. That means that it forces a line break before and after itself. See also:
Element object
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
align
6.0 +
4.0 +
-
1+
-
-
1.5 +
3.0 +
color
-
3.0 +
-
4.0 +
-
-
-
Warning
noShade
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
Warning
size
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
-
width
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
-
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onDblClick
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onDragStart
-
3.0 +
-
4.0 +
-
-
-
-
onFilterChange
-
3.0 +
-
4.0 +
-
-
-
-
onHelp
-
3.0 +
-
4.0 +
-
-
-
Warning
onKeyDown
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onKeyPress
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onKeyUp
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseDown
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseMove
1.5 +
3.0 +
6.0 +
4.0 +
-
-
4.0 +
Warning
onMouseOut
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseOver
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseUp
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onSelectStart
-
3.0 +
-
4.0 +
-
-
-
-
Inheritance chain: Element object, Node object
1035
JavaScript Programmer's Reference
HR.align (Property) An attribute to control the alignment of the object on screen. Availability:
DOM level - 1 JavaScript - 1.5 JScript - 3.0 Internet Explorer - 4.0 Netscape - 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myHR.align
The alignment of the HR object with respect to its containing parent object is defined in this property. The following expected and widely available set of alignment specifiers are available: ❑
absbottom
❑
absmiddle
❑
baseline
❑
bottom
❑
center
❑
left
❑
middle
❑
right
❑
texttop
❑
top
HR.color (Property) The color of the object. Availability:
JScript - 3.0 Internet Explorer - 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myHR.color
The color of the horizontal rule defined by this HR object will be defined in this property. The color can be specified in the normal way according to the HTML color specifiers.
1036
H – HR.noShade (Property)
Warnings: ❑
In JavaScript the noShade and color properties operate independently of one another, even though setting the COLOR="..." HTML tag attribute implies a NOSHADE attribute as well when defined in the document HTML source. See also:
Color names, Color value
HR.noShade (Property) A switch attribute, used to control whether there is a shadow around the object. Availability:
DOM level - 1 JavaScript - 1.5 JScript - 3.0 Internet Explorer - 4.0 Netscape - 6.0
Property/method value type:
Boolean primitive
JavaScript syntax:
-
myHR.noShade
This Boolean value can be set to true which will change the horizontalrule style from the 3D appearance to a flat non-shaded look. Setting the property to false restores the 3D-shaded appearance again.
Warnings: ❑
In JavaScript the noShade and color properties operate independently of one another even though setting the COLOR="..." HTML tag attribute implies a NOSHADE attribute as well when defined in the document HTML source.
HR.size (Property) A measure of the thickness of the object, expressed in pixels. Availability:
DOM level - 1 JavaScript - 1.5 JScript - 3.0 Internet Explorer - 4.0 Netscape - 6.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myHR.size
The thickness of the horizontal rule, measured in pixels.
1037
JavaScript Programmer's Reference
HR.width (Property) A width measurement of the object. Availability:
DOM level - 1 JavaScript - 1.5 JScript - 3.0 Internet Explorer - 4.0 Netscape - 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myHR.width
The width of the rule can be defined in pixels as an absolute measure or by specifying the value as a percentage of its containing element's width. Although the value is noted as being a String primitive, a numeric value is specified for the width measured in pixels. It is a string value simply sot hat it can accommodate the percentage value.
HTC (Definition) This is an abbreviation for the MSIE based HTML components (which used to be called scriptlets). See also:
Scriptlet, HTML Component
.htc (File extension) A file containing a behavior handler script for use in MSIE browsers. This file contains an HTML Component (HTC). These used to be called scriptlets but have been evolved and renamed when used in an MSIE web browser.The Windows Script Host environment continues to use scriptlets but these have also evolved into something quite different to an HTC. Refer to the Element.addBehavior() topic for a more detailed explanation of how these files are used. See also:
1038
<STYLE>, Element.addBehavior(), Scriptlet
H – .htm (File extension)
.htm (File extension) An HTML page.
Refer to: File extensions
HTML (Standard) The standard notation for creating web pages. HTML is short for HyperText Markup Language. It is a markup language belonging to the SGML (Standard Generalized Markup Language) family. Currently, the HTML state of the art is framed in the HTML version 4.0 standard as defined by the World Wide Web Consortium (W3C). However, much web content is still presented in an HTML 3.2 conformant manner. TV set-top boxes that employ HTML are generally built around an HTML 3.2 core which means that web content that needs to be deployed to the PC based browser and the TV viewer needs to be downgraded to be compatible with that standard version. Browser manufacturers are still yet to release fully HTML 4.0 compliant browsers. The strategic importance of HTML version 4.0 is to separate document content from presentation style. This means that certain techniques are deprecated in favor of the use of style sheets. This adds much complexity to the JavaScript support since its API to those style controls is not as well standardized as the underlying Document Object Model (DOM). However, there is also significant flexibility in the new styling model, and to date, the MSIE browser has made great strides in implementing a robust styling model that provides many Dynamic HTML capabilities. It is hoped that the forthcoming Netscape 6.0 might offer similar capabilities. See also:
Web browser
.html (File extension) An HTML page.
Refer to: File extensions
1039
JavaScript Programmer's Reference
HTML Character entity (Definition) Character value escapes for use in HTML. HTML Character entities are escape sequences that work in the HTML source domain. The character entities have a defined format that begins with an ampersand as a control sequence introducer and terminates with a semi-colon. The value between them is the character description. Many of these have symbolic names which browsers honor to a greater or lesser extent depending on the browser and its vintage. HTML 4.0 defines a large number of these escaped entities. If the character you wish to represent does not have a symbolic name, you can use the decimal value of the character and then place a hash symbol in-front. You can also use the hexadecimal notation by placing an x in front of the value. Thus: < defines the less-than or < symbol. ' defines a single quote or apostrophe character. ' also defines a single quote character. Here is a table of useful character entity values: Numeric
Named
Description
Netscape
MSIE
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Invisible
Space
-
-
Missing
Space
-
Horizontal tab
Space
Space
-
Line feed
Space
Space
-
-
Space
Space
-
-
Space
Space
-
Carriage return
Space
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
Table continued on following page
1040
H – HTML Character entity (Definition)
Numeric
Named
Description
Netscape
MSIE
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
-
Missing
Space
-
Space
Space
Space
!
-
Exclamation mark
Yes
Yes
"
"
Double quote
Yes
Yes
#
-
Hash
Yes
Yes
$
-
Dollar
Yes
Yes
%
-
Percent
Yes
Yes
&
&
Ampersand
Yes
Yes
'
-
Apostrophe
Yes
Yes
(
-
Left parenthesis
Yes
Yes
)
-
Right parenthesis
Yes
Yes
*
-
Asterisk
Yes
Yes
+
-
Plus
Yes
Yes
,
-
Comma
Yes
Yes
-
-
Hyphen
Yes
Yes
.
-
Period
Yes
Yes
/
-
Slash
Yes
Yes
0
-
Digit 0
Yes
Yes
1
-
Digit 1
Yes
Yes
2
-
Digit 2
Yes
Yes
3
-
Digit 3
Yes
Yes
4
-
Digit 4
Yes
Yes
5
-
Digit 5
Yes
Yes
6
-
Digit 6
Yes
Yes
7
-
Digit 7
Yes
Yes
8
-
Digit 8
Yes
Yes
9
-
Digit 9
Yes
Yes
:
-
Colon
Yes
Yes Table continued on following page
1041
JavaScript Programmer's Reference
Numeric
Named
Description
Netscape
MSIE
;
-
Semicolon
Yes
Yes
Greater than
Yes
Yes
?
-
Question mark
Yes
Yes
@
-
Commercial at sign
Yes
Yes
A
-
Letter A
Yes
Yes
B
-
Letter B
Yes
Yes
C
-
Letter C
Yes
Yes
D
-
Letter D
Yes
Yes
E
-
Letter E
Yes
Yes
F
-
Letter F
Yes
Yes
G
-
Letter G
Yes
Yes
H
-
Letter H
Yes
Yes
I
-
Letter I
Yes
Yes
J
-
Letter J
Yes
Yes
K
-
Letter K
Yes
Yes
L
-
Letter L
Yes
Yes
M
-
Letter M
Yes
Yes
N
-
Letter N
Yes
Yes
O
-
Letter O
Yes
Yes
P
-
Letter P
Yes
Yes
Q
-
Letter Q
Yes
Yes
R
-
Letter R
Yes
Yes
S
-
Letter S
Yes
Yes
T
-
Letter T
Yes
Yes
U
-
Letter U
Yes
Yes
V
-
Letter V
Yes
Yes
W
-
Letter W
Yes
Yes
X
-
Letter X
Yes
Yes
Y
-
Letter Y
Yes
Yes
Z
-
Letter Z
Yes
Yes
[
-
Left square bracket
Yes
Yes
\
-
Backslash
Yes
Yes
]
-
Right square bracket
Yes
Yes
^
-
Caret
Yes
Yes Table continued on following page
1042
H – HTML Character entity (Definition)
Numeric
Named
Description
Netscape
MSIE
_
-
Underscore
Yes
Yes
`
-
Grave accent
Yes
Yes
a
-
Letter a
Yes
Yes
b
-
Letter b
Yes
Yes
c
-
Letter c
Yes
Yes
d
-
Letter d
Yes
Yes
e
-
Letter e
Yes
Yes
f
-
Letter f
Yes
Yes
g
-
Letter g
Yes
Yes
h
-
Letter h
Yes
Yes
i
-
Letter i
Yes
Yes
j
-
Letter j
Yes
Yes
k
-
Letter k
Yes
Yes
l
-
Letter l
Yes
Yes
m
-
Letter m
Yes
Yes
n
-
Letter n
Yes
Yes
o
-
Letter o
Yes
Yes
p
-
Letter p
Yes
Yes
q
-
Letter q
Yes
Yes
r
-
Letter r
Yes
Yes
s
-
Letter s
Yes
Yes
t
-
Letter t
Yes
Yes
u
-
Letter u
Yes
Yes
v
-
Letter v
Yes
Yes
w
-
Letter w
Yes
Yes
x
-
Letter x
Yes
Yes
y
-
Letter y
Yes
Yes
z
-
Letter z
Yes
Yes
{
-
Left curly brace
Yes
Yes
|
-
Vertical bar
Yes
Yes
}
-
Right curly brace
Yes
Yes
~
-
Tilde
Yes
Yes
-
Undefined
Displays ?
Missing
-
Undefined
No
Displays ?
-
Undefined
No
Displays ?
-
Comma
Yes
Yes
-
Florin
Yes
Yes Table continued on following page
1043
JavaScript Programmer's Reference
Numeric
Named
Description
Netscape
MSIE
-
Right double quote
Yes
Yes
-
Ellipsis
Yes
Yes
-
Dagger
Yes
Yes
-
Double dagger
Yes
Yes
-
Circumflex
Yes
Yes
-
Permil
Yes
Yes
-
Undefined
Displays ?
Bugged
-
Less than
Yes
Yes
-
Capital OE ligature
Yes
Yes
-
Undefined
No
Displays ?
-
Undefined
No
Displays ?
-
Undefined
No
Displays ?
-
Undefined
No
Displays ?
-
Left single quote
Yes
Yes
-
Right single quote
Yes
Yes
-
Left double quote
Yes
Yes
-
Right double quote
Yes
Yes
-
Bullet
Yes
Yes
-
En dash
Yes
Yes
-
Em dash
Yes
Yes
-
Tilde
Yes
Yes
-
Trademark symbol
Yes
Yes
-
Undefined
Displays ?
Yes
-
Greater than
Yes
Yes
-
Small oe ligature
Yes
Yes
-
Undefined
No
Displays ?
-
Undefined
No
Displays ?
-
Capital Y umlaut
Yes
Yes
Non breaking space
Yes
Yes
¡
¡
Inverted exclamation
Yes
Yes
¢
¢
Cent sign
Yes
Yes
£
£
Pound sign
Yes
Yes
¤
¤
General currency symbol Displays ?
Displays ?
¥
¥
Yen sign
Yes
Yes
¦
¦
Broken vertical bar
Displays ?
Yes
§
§
Section sign
Yes
Yes
¨
¨
Umlaut
Yes
Yes Table continued on following page
1044
H – HTML Character entity (Definition)
Numeric
Named
Description
Netscape
MSIE
©
©
Copyright
Yes
Yes
ª
ª
Feminine ordinal
Yes
Yes
«
«
Left angle quote
Yes
Yes
¬
¬
Not sign
Yes
Yes
Soft hyphen
Displays ?
Yes
®
®
Registered trademark
Yes
Yes
¯
¯
Macron accent
Yes
Yes
°
°
Degree sign
Yes
Yes
±
±
Plus or minus
Yes
Yes
²
²
Superscripted 2
Displays ?
Yes
³
³
Superscripted 3
Displays ?
Yes
´
´
Acute accent
Yes
Yes
µ
µ
Micro sign
Yes
Yes
¶
¶
Paragraph
Yes
Yes
·
·
Middle dot
Yes
Yes
¸
¸
Cedilla
Yes
Yes
¹
¹
Superscripted 1
Displays ?
Yes
º
º
Masculine ordinal
Yes
Yes
»
»
Right angle quote
Yes
Yes
¼
¼
One quarter
Displays ?
Yes
½
½
One half
Displays ?
Yes
¾
¾
Three quarters
Displays ?
Yes
¿
¿
Inverted question mark
Yes
Yes
À
À
Capital A grave
Yes
Yes
Á
Á
Capital A acute
Yes
Yes
Â
Â
Capital A circumflex
Yes
Yes
Ã
Ã
Capital A tilde
Yes
Yes
Ä
Ä
Capital A umlaut
Yes
Yes
Å
Å
Capital A ring
Yes
Yes
Æ
Æ
Capital AE ligature
Yes
Yes
Ç
Ç
Capital C cedilla
Yes
Yes
È
È
Capital E grave
Yes
Yes
É
É
Capital E acute
Yes
Yes
Ê
Ê
Capital E circumflex
Yes
Yes Table continued on following page
1045
JavaScript Programmer's Reference
Numeric
Named
Description
Netscape
MSIE
Ë
Ë
Capital E umlaut
Yes
Yes
Ì
Ì
Capital I grave
Yes
Yes
Í
Í
Capital I acute
Yes
Yes
Î
Î
Capital I circumflex
Yes
Yes
Ï
Ï
Capital I umlaut
Yes
Yes
Ð
Ð
Capital eth
Displays ?
Bugged
Ñ
Ñ
Capital N tilde
Yes
Yes
Ò
Ò
Capital O grave
Yes
Yes
Ó
Ó
Capital O acute
Yes
Yes
Ô
Ô
Capital O circumflex
Yes
Yes
Õ
Õ
Capital O tilde
Yes
Yes
Ö
Ö
Capital O umlaut
Yes
Yes
×
×
Multiply
Displays ?
Yes
Ø
Ø
Capital O slash
Yes
Yes
Ù
Ù
Capital U grave
Yes
Yes
Ú
Ú
Capital U acute
Yes
Yes
Û
Û
Capital U circumflex
Yes
Yes
Ü
Ü
Capital U umlaut
Yes
Yes
Ý
Ý
Capital Y acute
Displays ?
Yes
Þ
Þ
Capital thorn
Displays ?
Bugged
ß
ß
Small sz ligature
Yes
Yes
à
à
Small a grave
Yes
Yes
á
á
Small a acute
Yes
Yes
â
â
Small a circumflex
Yes
Yes
ã
ã
Small a tilde
Yes
Yes
ä
ä
Small a umlaut
Yes
Yes
å
å
Small a ring
Yes
Yes
æ
æ
Small ae ligature
Yes
Yes
ç
ç
Small c cedilla
Yes
Yes
è
è
Small e grave
Yes
Yes
é
é
Small e acute
Yes
Yes
ê
ê
Small e circumflex
Yes
Yes
ë
ë
Small e umlaut
Yes
Yes
ì
ì
Small i grave
Yes
Yes
í
í
Small i acute
Yes
Yes
î
î
Small i circumflex
Yes
Yes Table continued on following page
1046
H – HTML Character entity (Definition)
Numeric
Named
Description
Netscape
MSIE
ï
ï
Small i umlaut
Yes
Yes
ð
ð
Small eth
Displays ?
Bugged
ñ
ñ
Small n tilde
Yes
Yes
ò
ò
Small o grave
Yes
Yes
ó
ó
Small o acute
Yes
Yes
ô
ô
Small o circumflex
Yes
Yes
õ
õ
Small o tilde
Yes
Yes
ö
ö
Small o umlaut
Yes
Yes
÷
÷
Divide
Yes
Yes
ø
ø
Small o slash
Yes
Yes
ù
ù
Small u grave
Yes
Yes
ú
ú
Small u acute
Yes
Yes
û
û
Small u circumflex
Yes
Yes
ü
ü
Small u umlaut
Yes
Yes
ý
ý
Small y acute
Displays ?
Yes
þ
þ
Small thorn
Displays ?
Bugged
ÿ
ÿ
Small y umlaut
Yes
Yes
Warnings: ❑
Inside <SCRIPT> tags, you are inside the JavaScript source domain and you use a different set of escape mechanisms. If you use the HTML escape mechanisms inside JavaScript source, your script is likely to break unless you are intentionally outputting them to the HTML source space via a document.write() method.
❑
The character set you are using inside the <SCRIPT> tags is completely different to that used in HTML. The script source is written using Unicode characters (ISO 10646). If you are generating HTML, a great manyof the character codes are mapped differently. This is because the HTML character entities are defined according to an ISO standard (ISO 8859). Even then, national language variants of the browser should map the character entity values to the correct character glyph which should ensure that what the designer intended is what you actually see, regardless of the actual character code transformations that take place.
❑
Most of the character entities are supported by both MSIE and Netscape. A few characters are supported inconsistently. All of the character entities with values less than 32 are control codes anyway, so although the browsers treat them differently, it shouldn't prove to be significant. Those character entities that are undefined in the HTML specification aren't supported in the same way either, and should probably be avoided. Recent updates to the HTML standard allow for Unicode character values to be used above character entity 255, and some of these have symbolic names defined. Refer tothe HTML specification available from the W3C at http://www.w3.org/TR/html4/ for further details.
❑
Of the rest:
❑
The general currency symbol (¤) is unsupported.
1047
JavaScript Programmer's Reference
❑
There is currently no Euro symbol implemented although its character entity • and Unicode value 20AC are defined but not in the version of the Unicode standard that is currently mandated (version 2.0). Unicode is about to undergo a revision and at that time, browser manufacturers will then need to accommodate the changes to remain compliant.
❑
The broken vertical bar (¦) does not work on Netscape, nor does the soft hyphen (), and neither do the superscripted numbers and fractional values.
❑
ETH and THORN are broken in both browsers in both upper and lower case variants.
❑
Netscape also lacks support for Y acute in both upper and lower case.
❑
Most of these are fairly obscure and not likely to cause much difficulty aside from some very specialized national language support. TheEuro character, however, is likely to become more important whether the currency thrives or not. See also:
Escaped JavaScript quotes in HTML,Portability
Web-references: http://www.w3.org/TR/html4/
HTML Comment tag ( <SCRIPT> // First create an image buffer array var myImages = new Array(10); // Now load the array with image objects getting them from the server for(var myIndex = 0; myIndex function moved() { document.all.ONE.width = event.x; } Move mouse horizontally to scale image
1077
JavaScript Programer's Reference
See also:
Background object, Document.images[], Element.all[], ImageArray object, IMG object, Input object, Input.type, Web browser
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
border complete
1.1 + 1.1 +
-
3.0 + 3.0 +
-
3.0 + 3.0 +
1+ -
-
constructor defaultValue height hspace lowsrc name size src vspace width x y
1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 +
-
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 +
-
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + -
1+ 1+ 1+ 1+ 1+ 1+ 1+ 1+ 1+ -
-
Warning, ReadOnly Warning ReadOnly ReadOnly Warning ReadOnly ReadOnly ReadOnly ReadOnly
Method
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
select()
1.1 +
-
3.0 +
-
3.0 +
1+
-
Warning
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onAbort
1.1 +
1.0 +
3.0 +
3.02 +
3.0 +
-
-
-
onBlur
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
-
Warning
onClick
1.1+
1.0 +
2.0 +
3.0 +
3.0 +
-
4.0 +
Warning
onDblClick
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onError
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
-
Warning
onFocus
1.1+
3.0 +
2.0 +
4.0 +
3.0 +
-
-
Warning
onHelp
-
3.0 +
-
4.0 +
-
-
-
Warning
onKeyDown
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onKeyPress
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onKeyUp
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onLoad
1.1+
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
onMouseDown
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseMove
1.2 +
3.0 +
4.0 +
4.0 +
-
-
4.0 +
Warning
onMouseOut
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseOver
1.1+
1.0 +
2.0 +
3.0 +
3.0 +
-
4.0 +
Warning
onMouseUp
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
1078
I – Image() (Constructor)
Inheritance chain: Element object, Node object
Image() (Constructor) A constructor for new browser images. Availability:
JavaScript – 1.1 JScript – 3.0 Internet Explorer – 4.0 Netscape – 3.0
JavaScript syntax:
-
new Image()
When the Image constructor is used in a new expression it creates a new object based on the Image prototype. You can then assign values to the properties of that new Image object as needed. Image objects are generally constructed so that image assets can be requested from the server and retained in the browser cache. This can happen in the background without the image needing to appear on the display. Then, when you need to perform an image replacement, the browser knows that the image is stored locally and can be located more quickly than if it had to request it from the server at the time it is required. This can significantly speed up the animation effects you choose to reproduce. See also:
Web browser
Image() (Function) A function for constructing new browser images. Availability:
JavaScript – 1.1 Netscape – 3.0
JavaScript syntax:
N
Image()
You can either use the function to create new images or another image object which can be cloned instead. See also:
Image(), Web browser
1079
JavaScript Programer's Reference
Image.border (Property) The thickness of the border round an image. Availability:
DOM level – 1 JavaScript – 1.1 Netscape – 3.0 Opera – 3.0
Property/method value type:
Boolean primitive
JavaScript syntax:
N
myImage.border
The border will be highlighted if the image is embedded inside an anchor tag.
Image.Class (Property/internal) Internal property that returns an object class. This is an internal property that describes the class that an Image object instance is a member of. The reserved words suggest that in the future, this property may be externalized. See also:
Web browser
Property attributes: DontEnum, Internal.
Image.complete (Property) The current state of an image loading operation. Availability:
JavaScript – 1.1 Netscape – 3.0 Opera – 3.0
Property/method value type:
Boolean primitive
JavaScript syntax:
N
myImage.complete
This is a Boolean property that reflects the current loading status of an image object. It should yield the value false until the image has completely transferred from the server to the client browser.
Warnings: ❑
Netscape 4 will incorrectly yield a true value when the image has not yet completely loaded.
Property attributes: ReadOnly.
1080
I – Image.constructor (Property)
Image.constructor (Property) An Image object constructor. Availability:
JavaScript – 1.1 Netscape – 3.0
Property/method value type:
Image object
JavaScript syntax:
N
myImage.constructor
The constructor is that of the built-in Image prototype object. You can use this as one way of creating arrays, although it is more popular to use the new Image() technique. This property is useful if you have an object that you want to clone but you don't know what sort of object it is. Simply access the constructor belonging to the object you have a reference to. Netscape provides constructors for many objects, virtually all of them in fact, even when it is highly inappropriate to do so. MSIE is far more selective and there are some occasions when you might wish for a constructor that MSIE does not make available.
Image.height (Property) The height of an image. Availability:
DOM level – 1 JavaScript – 1.1 Netscape – 3.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
N
myImage.height
The image space is defined by an extent rectangle that surrounds the space occupied by it on the screen. The extent rectangle is the smallest rectangle that can completely enclose the item. This property specifies the height of that extent rectangle. Including height and width information on images is optional, but it can significantly improve the performance of the layout engine as it renders the web page. This is because the layout engine does not need to wait until the image has been fetched before reserving sufficient space for it in the display. See also:
Image.width, IMG.height, IMG.width
Property attributes: ReadOnly.
1081
JavaScript Programer's Reference
Image.hspace (Property) The horizontal spacing attribute value. Availability:
DOM level – 1 JavaScript – 1.1 Netscape – 3.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
N
myImage.hspace
Margins placed around objects are either modified separately with all four margin sides having a different property or by adjusting the horizontal margins and vertical margins using just two values. The hspace property controls the margin to the left and right of the object. See also:
IMG.hspace
Property attributes: ReadOnly.
Image.lowsrc (Property) The low-resolution version of the image can be supplied from this URL. Availability:
DOM level – 1 JavaScript – 1.1 Netscape – 3.0 Opera – 3.0
Property/method value type:
String primitive
JavaScript syntax:
N
myImage.lowsrc
This is a useful technique to make the site appear to be faster than it really is. You specify a low resolution version of the image that can be contained in a much smaller file. This is then loaded first by the browser while it downloads the larger image. Although this property is read/write, changing it does not force the image to be reloaded again. DOM level 1 describes this as a lowSrc property. Note the capitalization. For this to work as intended, you must specify the lowsrc (lowSrc) property value prior to the src property value otherwise the high quality image will be fetched first. See also:
1082
Image animation, IMG.lowsrc
I – Image.name (Property)
Image.name (Property) This corresponds to the NAME attribute of the tag. Availability:
DOM level – 1 JavaScript – 1.1 Netscape – 3.0 Opera – 3.0
Property/method value type:
String primitive
JavaScript syntax:
N
HTML syntax:
myImage.name
Objects are identified either by the NAME="..." HTML tag attribute or by the ID="..." HTML tag attribute. Netscape shows a marginal preference for the name property, while MSIE seems slightly better disposed towards the ID property. However, in many cases both browsers support either technique and in some cases will locate items named with either tag as if they existed in a single namespace. This property cannot be used with Image objects that are manufactured at run-time from the Image() constructor. They can be collected in an array and accessed associatively as named array elements, but images you create in script aren't part of the document and therefore can't be addressed as if they are. See also:
IMG.name
Image.src (Property) The URL where the image is located. Availability:
DOM level – 1 JavaScript – 1.1 Netscape – 3.0 Opera – 3.0
Property/method value type:
String primitive
JavaScript syntax:
N
myImage.src
If you change the src property of an image it will be replaced on the browser's display screen. The only limitation is that the images that are replaced are exactly the same shape and size as the previous image. Some browsers may forgive you if you display differently sized images, and some may scale the images to fit.
1083
JavaScript Programer's Reference
This can lead to all manner of creative effects such as rollover highlights, clocks, animations, progress bars etc. You can also simulate checkboxes graphically as well as all manner of other useful and 'pretty' user interface widgets. For animations to work smoothly, you should ensure that the images have been cached locally first otherwise the animation will appear somewhat jerky while they are fetched from a server. See also:
Image animation, Image preloading, IMG.src
Image.vspace (Property) The vertical spacing attribute value. Availability:
DOM level – 1 JavaScript – 1.1 Netscape – 3.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
N
myImage.vspace
Margins placed around objects are either modified separately, with all four margin sides having a different property, or by adjusting the horizontal margins and vertical margins using just two values. The vspace property controls the margin at the top and bottom of the object. See also:
IMG.vspace
Property attributes: ReadOnly.
Image.width (Property) The width of an image. Availability:
DOM level – 1 JavaScript – 1.1 Netscape – 3.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
N
1084
myImage.width
I – Image.x (Property)
The image space is defined by an extent rectangle that surrounds the space occupied by it on the screen. The extent rectangle is the smallest rectangle that can completely enclose the item. This property specifies the width of that extent rectangle. Including height and width information on images is optional, but it can significantly improve the performance of the layout engine as it renders the web page. This is because the layout engine does not need to wait until the image has been fetched before reserving sufficient space for it in the display. See also:
Image.height, IMG.height, IMG.width
Property attributes: ReadOnly.
Image.x (Property) The X coordinate of the image within the client display area. Availability:
JavaScript – 1.1 Netscape – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
N
myImage.x
The horizontal position of the object in the display, measured in pixels. You can use the x and y coordinates of the object as targets of the scrollTo() method for the window it lives in.
Property attributes: ReadOnly.
Image.y (Property) The Y coordinate of the image within the client display area. Availability:
JavaScript – 1.1 Netscape – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
N
myImage.y
The vertical position of the object in the display, measured in pixels. You can use the x and y coordinates of the object as targets of the scrollTo() method for the window it lives in.
Property attributes: ReadOnly.
1085
JavaScript Programer's Reference
Image preloading (Useful tip) A technique for caching images locally in readiness for an animation. If you want to animate some images, you will need to cache them locally to make sure the animation moves smoothly. If you don't, the animation will be very jerky while the images are fetched from the server. The action of setting the src attribute of the image object in the buffer array is simply to recall the images and store them in the cache. The image objects then act as a repository to store the src value so it can be assigned to the target image in an animation loop.
Warnings: ❑
Note that this technique is a waste of time if you set your browser cache to zero bytes capacity and force a document to be requested from the server every time, at least that is what happens in MSIE (and is what you would expect).
❑
Netscape adds a trick to this by caching objects that you are holding in memory and referencing via script variables – it's a little smarter, and knows that you are intentionally caching images even though you have set your cache size to zero.
❑
Some versions of MSIE fetch the image from the server every time you reference it, regardless of your cache settings or the fact that you have preloaded it and stored a reference to it in a variable.
Example code:
<SCRIPT> // Create a JavaScript object that encapsulates a Java Class var myJavaDateClass = new Packages.java.util.Date; // Now enumerate its properties var myIndex = 0; for(myProp in myJavaDateClass) { document.write(""); document.write(myIndex); document.write(" | "); document.write(myProp); document.write(" | "); document.write(typeof(myProp)); document.write(" | "); document.write(myProp.length); document.write(" | "); document.write(escape(myProp)); document.write(" |
"); myIndex++; }
See also:
Applet object, Document.applets[], Document.embeds[], EmbedArray object, Java to JavaScript values, java.lang.Object, JavaObject.booleanValue(), JavaScript to Java values, LiveConnect, Packages.java, Packages.netscape, Window.Packages
Property
JavaScript
JScript
N
IE
Opera
Notes
description
1.1 +
-
3.0 +
-
-
Warning
filename
1.1 +
-
3.0 +
-
-
Warning
length
1.1 +
-
3.0 +
-
-
Warning
name
1.1 +
-
3.0 +
-
-
Warning
Method
JavaScript
JScript
N
IE
Opera
Notes
booleanValue()
1.2 +
-
4.0 +
-
-
-
destroy()
1.1 +
-
3.0 +
-
-
Warning
disable()
1.1 +
-
3.0 +
-
-
Warning
doubleValue()
1.1 +
-
3.0 +
-
-
Warning
Table continued on following page
1204
J – JavaObject.booleanValue() (Method/Java)
Method
JavaScript
JScript
N
IE
Opera
Notes
enable()
1.1 +
-
3.0 +
-
-
Warning
getAppletContext()
1.1 +
-
3.0 +
-
-
Warning
getAppletInfo()
1.1 +
-
3.0 +
-
-
Warning
getBackground()
1.1 +
-
3.0 +
-
-
Warning
getClass()
1.2 +
-
4.0 +
-
-
Warning
getCodeBase()
1.1 +
-
3.0 +
-
-
Warning
getDocumentBase()
1.1 +
-
3.0 +
-
-
Warning
getLocale() getParameter() getParameterInfo() getToolkit() hide() init() isActive() isEnabled() isShowing() isValid() isVisible() minimumSize() refresh() start() stop() toString()
1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 +
-
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 +
-
-
Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning
JavaObject.booleanValue() (Method/Java) This is the value that is used when the JavaObject is used in a Boolean context. Availability:
JavaScript – 1.2 Netscape – 4.0
JavaScript syntax:
N
myJavaObject.booleanValue()
Java Boolean objects support this method. It is a Java method but it is analogous to the valueOf() method used on a JavaScript Boolean object. Because all Java objects become members of the JavaObject class they respond to valueOf() and toString() but those can be overridden in the JavaScript environment. The booleanValue() method penetrates to the Java environment and is executed there with its result encapsulated. The valueOf() and toString() methods are executed in the JavaScript environment even if there is a corresponding Java method for each.
1205
JavaScript Programmer's Reference
The example shows all three methods being invoked but the toString() and valueOf() are masked. Note that by masking toString(), valueOf() is affected too. That may not be common to all object types. There are other similar methods to support different Java primitive data types when they are encapsulated in an object. Only this one is illustrated. The others are different only in the data type and the name they have.
Example code: <SCRIPT> // Create a JavaScript object that encapsulates a Java Class var myJavaBooleanClass = new Packages.java.lang.Boolean(true); // Mask the JavaScript environment values myJavaBooleanClass.toString = mask; // Write the object to a web page document.write("toString() : "); document.write(myJavaBooleanClass.toString()); document.write("
"); document.write("valueOf() : "); document.write(myJavaBooleanClass.valueOf()); document.write("
"); document.write("booleanValue() : "); document.write(myJavaBooleanClass.booleanValue()); document.write("
"); // Masking function function mask() { return "Masked"; }
See also:
JavaObject object, LiveConnect
JavaObject.getClass() (Method/Java) A JavaScript method for obtaining the class of a JavaObject. Availability:
JavaScript – 1.2 Netscape – 4.0
JavaScript syntax:
N
myJavaObject.getClass()
This returns the Java class of the encapsulated Java object. This is not necessarily the same as a JavaScript class name. In fact what is returned is an object reference to a class object which may need further work to extract the name of the class.
1206
J – JavaPackage object (Object/Navigator)
The example shows how a Java object is instantiated and then enquired to as of its class. Using the LiveConnect, the getClass() method requests the class name from the Java code and then converts that to a JavaScript message. Inspecting the constructor of the new object and extracting its name property tells you what class JavaScript has wrapped around the Java object.
Warnings: ❑
Beware that you don't confuse this JavaScript getClass() method with the Java getClass() method. Although they have the same name, they yield a different result. The JavaScript method yields a JavaScript object of the class JavaClass. The Java method yields a Java object of the class java.lang.Class, which is not the same thing.
Example code: <SCRIPT> // Instantiate a Java object myJavaString = new java.lang.String; // Display its Java class document.write("Java class : "); document.write(myJavaString.getClass()); document.write("
"); // Display its JavaScript class document.write("JavaScript class : "); document.write(myJavaString.constructor.name); document.write("
");
See also:
LiveConnect
JavaPackage object (Object/Navigator) A JavaScript data type that encapsulates a Java Package. Availability:
JavaScript – 1.2 Netscape – 4.0
JavaScript syntax:
N
myJavaPackage = myWindow.Packages
A collection of Java classes are represented as a package. The complete set of all available Java Packages are contained within a single parent JavaPackage object. This constructs a hierarchy of JavaPackage and JavaClass objects. The properties of the JavaPackage object are those that refer to any Java Class or Java Packages that belong to it. However, these are generally not enumerable so you do need to know what they are called before you can access them.
1207
JavaScript Programmer's Reference
Because you cannot enumerate the properties of this object you won't be able to walk a Java package hierarchy with a script driven tree walker. The JavaPackage tree structure resembles the directory structure that the Java class files are stored in. Some class files are collected into ZIP archives but even then the hierarchy is still intact and there will be one package that represents the ZIP file and corresponds to that node in the tree. Any arbitrary collection of classes will be represented by a JavaPackage object, regardless of how they are stored in the file system.
Example code: // Create a JavaScript object that encapsulates a Java Package var myJavaPackage = Packages.java.util;
See also:
JavaScript to Java values, LiveConnect, netscape.applet, Packages.java, Packages.netscape, Window.java, Window.Packages, Window.sun
JavaScript Bookmark URLs (Advice) Bookmarks composed of JavaScript calls. You can build a bookmark by typing in a JavaScript URL. You do need to be careful as you type it in. To create a JavaScript bookmark, open the bookmark manager and create a new entry. Be careful to only refer to objects that are likely to exist regardless of the page on view. You can crash the logic of the browser if your bookmark script tries to manipulate objects that belong to a page other than that which you are browsing. It is necessary to work within these limitations because the user may request a bookmark at any time. These JavaScript-coded bookmarks are sometimes known as Bookmarklets. It is possible to create bookmarklets to aid in a number of information-gathering and debugging tasks. The example demonstrates how to display form elements in a pop up window. This only works if your bookmarks can hold a long enough URL value. It works fine in MSIE and Netscape 6.0, but not in version 4.0 of Netscape although you can paste it into the location bar and hit return for the same effect. Upon testing it was found that only the Opera 5 browser has a security check to ask whether the script is allowed to check the password.
Example code: // // // // // // //
1208
Provided for our enjoyment by Jon Stephens Note, the line breaks and space have been added to aid readability. You should omit the line breaks when inserting this into the bookmark. Any unnecessary spaces can also be removed to prevent URL buffer overruns. This also works fine when wrapped in a function declaration and called from a button on the form page.
J – JavaScript debugger console (Advice)
javascript:var output = ""; for(var i = 0; i < document.forms.length; i++) { for(var j = 0; j < document.forms[i].elements.length; j++) { output += "Form " + i+ " -- # " + j + " -- Type: " + document.forms[i].elements[j].type + "; " + document.forms[i].elements[j].name + ": " + document.forms[i].elements[j].value + "
"; } } var newWin = window.open("","newWin","width=350,height=350"); with(newWin.document) { open(); write(output); close(); }
See also:
Bookmarklets, JavaScript interactive URL, javascript: URL
Cross-references: Wrox Instant JavaScript – page 49
JavaScript debugger console (Advice) Netscape JavaScript debugger console window for viewing error logs. If you type the javascript: URL method into the location box on a Netscape 4 browser and then press return, the web browser will display a debugging console window that gives you some helpful messages about what is happening in your script. It can certainly speed up the debugging process when you are trying to trace a fault. You can type short pieces of JavaScript source code into the type-in box and press return and the results will be executed in console. For example, to see the value of some mathematical constants, you type these lines into the location box: Math.PI Math.LOG10 Number.MAX_VALUE
Warnings: ❑
A small bug in the console requires that the first item be triggered with two carriage returns. For some reason the console eats the first message and then spits it out with the second. Everything is fine after that.
1209
JavaScript Programmer's Reference
See also:
Debugging – client side, JavaScript interactive URL, javascript: URL
Cross-references: Wrox Instant JavaScript – page 48
JavaScript Document Source URL (Definition) JavaScript can be called directly instead of fetching a page. JavaScript URLs can be used in the HREF attribute of an anchor tag. If this technique is used, a fragment of JavaScript code can call in an external function and generate the content of another page without ever calling a web server for the page. Quite sophisticated dynamic page generation can be accomplished like this, however, at some stage you will have to have downloaded the JavaScript code to be executed in the first place.
Example code: <SCRIPT> var the_value = 100; function increment() { the_value++; } Click to display the value Click to increment the value
See also:
JavaScript Image Source URL, javascript: URL
JavaScript embedded in Java (Definition) Java applets can contain JavaScript code fragments that can be executed by the applet. You can embed fragments of JavaScript inside Java applets although there are some limitations to what you can accomplish with this. For this to work, Java and JavaScript both have to be enabled and working. This may require some preference setting. Currently, it only works in Netscape. The <APPLET> tag is the main way to embed a Java applet within an HTML document. That much generally works across all browsers. JavaScript scripts should always have access to all the internals of a Java applet that it cares to make publicly available. However, the converse is not necessarily true. Java applets may not access the script-owned object space unless you give them permission to do so.
1210
J – JavaScript entity (Pitfall)
This is done with the MAYSCRIPT tag attribute on the <APPLET> tag. The Java applet can then mimic JavaScript methods using the Java syntax, and there are mechanisms for accessing eval() functionality for interpreting JavaScript source text. See also:
Java, Java exception events, JSObject object, MAYSCRIPT
Cross-references: Wrox Instant JavaScript – page 57
JavaScript entity (Pitfall) This functionality is deprecated and should not be used in new projects. The HTML character entities are useful for describing hard to type characters. They are functionally similar to the back-quote substitutions that are available server-side with Netscape Enterprise Server. MSIE version 3.0 introduced a means of passing JavaScript values into the HTML source space using a syntax that is similar to the character entity syntax. However, it is used in contexts that character entities were never intended to be used in. It is also advised as deprecated functionality in the HTML version 4.0 standard. You might indicate an image width like this:
The value for the image width can be taken from a JavaScript expression like this:
This assumes that the values myWidth and myScaleFactor have already been defined in some earlier fragment of JavaScript. The entity can be used to replace a single character in the tag attribute value so you can concatenate other characters such as percent signs if you use it in tags for example. This functionality should be avoided and the usual client or server methods used to define the values in HTML tags.
Example code:
See also:
Adding JavaScript to HTML, Backquote (`), Deprecated functionality, Pitfalls
Cross-references: Wrox Instant JavaScript – page 47
1211
JavaScript Programmer's Reference
JavaScript Image Source URL (Definition) Image data can be generated in some browsers. Within some limitations, you can generate image data within a web browser's JavaScript environment. This seems to work best on the Netscape version 4.0 browser, but it is worth exploring somewhat to see if it can be exploited on other browsers. If you store this text into a script variable it describes a 1 pixel image: #define x_width 1 #define x_height 1 static char x_bits[] = {0x00}; This is the code for an XBM image. It is only black and white but it may be useful to be able to create an image with a script. Now you can call this as the source of an image like this: The example works as it is in Netscape 4.0. Adding a MIME type header will help browsers to determine what the content type is and this technique doesn't need to be confined to just image data.
Example code: <SCRIPT> var the_image_data; the_image_data = "Content-type: image/x-xbm"; the_image_data = ""; the_image_data = "#define x_width 10\n"; the_image_data += "#define x_height 1\n"; the_image_data += "static char x_bits[] = {"; the_image_data += "0xFF,0xFF,0xFF,0xFF,0xFF,"; the_image_data += "0xFF,0xFF,0xFF,0xFF,0xFF"; the_image_data += "};";
See also:
JavaScript Document Source URL, javascript: URL, MIME types
Cross-references: Wrox Instant JavaScript – page 49
1212
J – JavaScript interactive URL (Request method)
JavaScript interactive URL (Request method) An interactive JavaScript statement executor. Availability:
JavaScript – 1.0 JScript – 3.0 Internet Explorer – 4.0 Netscape – 2.0
You can type short pieces of JavaScript source code into the location box and press return and the results will be executed in the document window. For example, to see the value of some mathematical constants, you type these lines: javascript:Math.PI javascript:Math.LOG10 javascript:Number.MAX_VALUE javascript:alert(top.location) See also:
Bookmarklets, JavaScript Bookmark URLs, JavaScript debugger console, javascript: URL
Cross-references: Wrox Instant JavaScript – page 48
JavaScript language (Overview) JavaScript overview summary. Availability:
ECMAScript edition – 2
JavaScript is a so-called third generation language. JavaScript was originally developed by Netscape Communications and is influenced by many other languages. Most notably, it borrows from: ❑
C language
❑
Pascal
❑
BASIC
❑
Java
❑
Perl
❑
Other scripting languages
This means that if you have already used any of these other languages, it is likely that you will become proficient in JavaScript fairly quickly. JavaScript and Java are two distinctly different languages. They even operate in a different architectural way. JavaScript is interpreted while Java is compiled. It is a lot simpler to get started using JavaScript and designers find it’s a good way to become accustomed to the more intense software developer issues.
1213
JavaScript Programmer's Reference
Java code tends to be quite self-contained and not require the help of any additional systems. On the other hand, JavaScript is often more like a kind of glue that joins various parts of the web together so they can inter-operate more effectively. JavaScript is object-based. That is to say, the basic language operation and access to the hosting environment is by means of objects that represent items in the real world. A JavaScript application is built from a collection of various kinds of objects, which communicate with one another. Every JavaScript environment comes with a set of Core Objects. These provide the fundamental basis on which the language is built. It is these objects that are defined in the ECMAScript standard. There is a Global Object which is the topmost object in the hierarchy. Other objects such as the Math Object provide more specialized capabilities. In JavaScript we talk about primitive values having a type. There are a set of standard types builtin to the core JavaScript interpreter. Although JavaScript is object-based, it is not a class based object oriented language, and so while these Primitive Types behave very much like object oriented classes, they aren't really implemented as such. The language does provide some facilities for creating new object types however. An Object in the JavaScript environment is a collection of Properties which you can access by name. Some you can only access in a read-only fashion while others can be modified. The Properties have attributes such as a read-only flag, which controls this access to the values contained in the property. Properties may have other attributes as well and can often be a reference to another object. Requesting a property from an object can therefore yield another object, which in turn has properties of its own. If you think of the properties as containers you'll soon feel comfortable with the concept. Objects can also respond to messages, each of which will invoke a named Method. Those methods may behave much like a property request or they may cause some action to happen. At the JavaScript programming level, methods and properties begin to lose their distinction. Methods are often analogous to Functions in other languages. Indeed, methods are implemented as functions that are attached to objects by means of properties. You may use functions in a traditional way, very much like you would in C, but the functions you use in the scripts are actually methods that belong to the global object. However, in that case you don't need to specify which object should execute the method. The syntax of JavaScript intentionally mimics that of Java but many rules are relaxed to make the language easier to use. For example, you don't need to declare the type of a variable before using it. Properties don't need to have their type specified and functions do not need to be placed earlier in the script than when they are first invoked. Although JavaScript is intended to be forgiving and therefore easy to be comfortable with and yet not be a hard-core programmer, beyond the simple basics, it certainly is not a simple language to learn and exploit fully. See also:
Constant expression, Declaration, ECMAScript, Expression, Free-format language, History, int, JavaScript version, Lexical element, LiveScript, Native feature, Overview, Statement
Cross-references: ECMA 262 edition 2 – section – 4.2 ECMA 262 edition 3 – section – 4.2 O'Reilly JavaScript Definitive Guide – page 2
1214
J – JavaScript Style Sheets (Definition)
Wrox Instant JavaScript – page 1 Wrox Instant JavaScript – page 11
JavaScript Style Sheets (Definition) A standard for describing style sheets. The JavaScript Style Sheet facility (JSS) is based on the CSS level 1 capabilities. They are only supported in the version 4.0 Netscape browsers and are now completely deprecated. Netscape 6.0 does not support them at all. This gives rise to some concerns on portability issues. However, if your web server is capable of recognizing the user agent value and serving different content accordingly, you may be able to ensure that JSS style sheets are served only to requesting Netscape 4.0 browsers and that other browsers will be presented with CSS style sheets instead. The main difference is in the notation used to describe the JSS rules. There are two ways to call in a JSS defined style sheet, either with the <STYLE> tag, which embeds the style definitions into the page, or with the tag, which includes them from an external document. Creating styles in JavaScript comes down to correctly forming the object model that refers to the style properties of the document object. This is managed by means of a tags object, which is the root of a collection of objects for which the style can be defined as properties. By and large the tags object has a property that corresponds to every style controllable HTML tag. It’s fairly easy to guess the likely syntax and give a CSS reference, you can probably figure out the properties of the individual objects. The properties correspond with those attributes of the instances of the tags described in the browser object model (or the DOM if you prefer). There are some special methods and functions defined for JSS to be used when creating styles. These are: ❑
margins()
❑
rgb()
❑
contextual()
For JavaScript to be able to modify style settings, it needs to be able to read the current values and to be able to write new values into the object properties. In Netscape 4.0, the absolute and relative style properties apply to positioning of an object. If these are present, the objects are assumed to be in layers. Layers can be controlled very effectively from within JavaScript. they can be moved, sized and have their visibility changed. However there are rendering issues and the effects are complex and hard to control when some styled objects are already rendered on the page. Some tags can have absolute positioning applied directly but it is not portable across minor revision changes of the browser. MSIE version 4.0 provides dynamic style control. It is improved significantly in version 5.0 and 5.5 and the same DOM based model is built into Netscape 6.0. The styles are available as host objects. You can modify the appearance of styled object in MSIE even after they have already been displayed. Changing the style or position of an object gives you all the capabilities that layers provided in Netscape, and an automatic damage repair redraw is also triggered if necessary when the style of an object is modified.
1215
JavaScript Programmer's Reference
Warnings: ❑
JSS comes about because internally Netscape 4.0 converts CSS rules into JavaScript code and executes it as such. That is why you lose styling when you turn off JavaScript for security reasons.
❑
Netscape decided to make this interface available to the developer and exposed it as JSS. This means there is a conflicting alternative to CSS. It is very unlikely that JSS would be supported in any other browser than Netscape 4.0 given that most browser manufacturers are striving for standards compliance. They will all be supporting CSS2 fully in due course.
❑
It is therefore recommended that while you may want to experiment with JSS, it is a deprecated item. As such you probably should avoid deploying it in any mission critical projects or using it in new developments.
❑
MSIE 3.0 does not allow JavaScript access to style properties.
❑
The JSS functionality is removed from Netscape 6.0.
Example code: <STYLE TYPE="text/JavaScript">tags.P.borderWidth = 10;tags.B.color = “#FF0000”;
See also:
<META>, <STYLE TYPE="...">, <STYLE>, Case Sensitivity, contextual(), CSS level 1, Document object, JSS, JSSTag.apply, JSSTag.margins(), JSSTag.rgb(), JSSTags object
Cross-references: Wrox Instant JavaScript – page 50
JavaScript to Java values (Definition) Conversion of JavaScript primitives and objects to Java compatible types. When a Java method is called from JavaScript, the JavaScript values need to be converted to compatible and useful data types. In some cases a single JavaScript type will be compatible with arguments of many different types. An example of this is the JavaScript Number primitive that will convert readily into half a dozen different Java types. Some JavaScript data types correspond exactly to a single and specific Java type. An example of this is null. A third possibility is that many different JavaScript types will become a single Java type. This is what happens to objects which all become a generic JavaScript object represented by the Java class JSObject.
1216
J – JavaScript to Java values (Definition)
Here is a table that summarizes the correspondence between JavaScript and Java types when converting to Java. This would be used when passing values into methods under control of JavaScript: JavaScript
Java
boolean primitive
boolean
boolean primitive
java.lang.Boolean
null
null
number primitive
byte
number primitive
char
number primitive
double
number primitive
float
number primitive
int
number primitive
java.lang.Double
number primitive
long
number primitive
short
string primitive
java.lang.String
Function object
netscape.javascript.JSObject
JavaArray object
netscape.javascript.JSObject
JavaClass object
netscape.javascript.JSObject
JavaMethod object
netscape.javascript.JSObject
JavaObject object
The encapsulated Java object unwrapped
JavaPackage object
netscape.javascript.JSObject
netscape.javascript.JSObject
java.lang.String
All other JavaScript objects
netscape.javascript.JSObject
When this happens under the control of Java, there are further limitations as to what can be exchanged between the environments. This is discussed under the individual methods that are affected in the JSObject description. This table summarizes the relationships at the passing interface. JavaScript values may have been converted during the expression evaluation. You may also need to coerce some values as they are passed so they are correctly mapped to the Java interface for the method. Java objects are wrapped so that JavaScript can access them as a JavaObject object. When they are passed back to Java, the encapsulation is removed and the intrinsic Java object is accessed directly.
Warnings: ❑
Be aware that you can lose precision when passing data into and out of a Java applet method. As well as type conversion, value truncation may occur.
❑
JavaScript number values can interface to java.lang.Double method arguments but not to java.lang.Integer or java.lang.Float.
1217
JavaScript Programmer's Reference
❑
Because JavaScript does not have a character data type, numbers can map to Java char data types. A character in a string in JavaScript is presented as a String primitive but is only one character long. This will convert to java.lang.String but will not naturally convert to a Java char data value unless you make some effort in the script to prepare it first. A String.charCodeAt() conversion may be necessary.
❑
Some Java encapsulations are not unwrapped when the value is passed to Java. A JavaPackage, JavaArray, JavaClass and the deprecated JavaMethod are all encapsulated as a JSObject. This may cause problems if the objects are passed backwards and forwards as the encapsulation might become increasingly nested. This behavior would be classed as erroneous and may be platform dependent. It may also depend on what happens inside the applet code when the method is called.
❑
JavaScript arrays are not converted to Java arrays of JSObject items. They are passed as a JSObject encapsulated as a whole. See also:
Boolean, Function object, Java method data conversion, Java to JavaScript values, JSObject object, JSObject.call(), JSObject.eval(), JSObject.getMember(), JSObject.getSlot(), JSObject.toString(), LiveConnect, netscape.javascript.JSObject, null
JavaScript version (Standard) The version history for JavaScript. JavaScript was initially developed by Netscape Communications and was originally called LiveScript 1.0. Around that time, the Java language was becoming more popular and possibly as a marketing ploy, the name of LiveScript was changed to JavaScript. It was first available to the public in version 2.0 of Netscape. Version
ECMA
Notes
LiveScript 1.0
No
The original precursor to JavaScript
JavaScript 1.0
No
Netscape 2.0 implemented this. Now mostly obsolete.
JavaScript 1.1
Yes
Supported in Netscape 3.0 and Netscape Enterprise Server 2.0. Also supported in Opera 3.0. More robust and better support for arrays. Image replacement and access to plugin properties. Scroll control.
JavaScript 1.2
No
Netscape 4.0 to 4.05 added RegExp, switch and delete. Screen object and interval timer. Window move & resize. Object and array literals added.
JavaScript 1.3
Yes
Version 4.06 to 4.76 of Netscape adds better exception handling. Also supported by Netscape Enterprise Server 3.
JavaScript 1.4
Yes
Netscape version 5.0 (not widely released).
JavaScript 1.5
Yes
Netscape 6.0 (final beta stages at time of writing).
See also:
History, JavaScript language, JScript version, LiveScript
Cross-references: O'Reilly JavaScript Definitive Guide – page 3 Wrox Instant JavaScript – page 3
1218
J – javascript: URL (Request method)
javascript: URL (Request method) Execute some JavaScript code instead of fetching a document. When you specify a URL in a web browser, the intent is usually to fetch a document from a remote web server. The javascript: URL method is used to execute a fragment of JavaScript code when the URL is requested. You can use the javascript URL as follows: ❑
To call up the debugger console
❑
To interactively execute statements
❑
As document source
❑
As bookmarks
The view-source: URL can be used in Netscape to call up a source view of a document under script control. Its not very portable and not much use for anything other than debugging. These are all described in separate topics. You can call up the JavaScript debugger by setting a document location to "javascript:", "livescript:" or "mocha:". Looking at the internals of the Netscape browser, this debugging console is itself written in HTML with JavaScript dynamic actions. Mostly, these special URLs will be useful for debugging – getting details of the disk cache may be useful for example. Pulling up the JavaScript debugger page if you detect an error in your script might also be a cool trick. With a javascript: URL, you can also type the code directly into the location bar of your Netscape browser to see the results of evaluating it right away. As of JavaScript version 1.1, you can use the void operator to discard the result of an expression. This javascript: URL form is vailable in the WebTV set top boxes effective from the Summer 2000 release. However, it cannot be typed in manually by the user as it can be in the desktop computer based web browsers.
Warnings: ❑
This technique does not work with MSIE 3.0.
❑
The JavaScript debugger is not present in MSIE at all, although it may be possible to use the Visual J++ debugging tools if you have them installed.
❑
Almost too late for inclusion was a report that History.back() calls that worked in JScript 5.1 started to fail on upgrade to JScript 5.5 service pack 1. In the end it turned out to be related to calling a javascript: URL within an context. In earlier versions of MSIE, you could omit the single and double quotes around the URL. Version 5.5 is no longer forgiving that omission. This may affect other kinds of URL values and other HTML tag attributes in an MSIE 5.5 browser.
1219
JavaScript Programmer's Reference
Example code: <SCRIPT> function test() { alert("Test function called"); } Click on me
See also:
Adding JavaScript to HTML, Bookmarklets, JavaScript Bookmark URLs, JavaScript debugger console, JavaScript Document Source URL, JavaScript Image Source URL, JavaScript interactive URL, mailbox: URL, mailto: URL, URL, void
JellyScript (Definition) The JavaScript interpreter inside a WebTV set-top box is referred to as JellyScript. This interpreter is based on the normal web browser JavaScript with a few limitations and some additional functionality. The interpreter functionality is mainly limited due to the small amount of memory available in the set-top box. Low memory is important to keep the manufacturing costs as small as possible. The JellyScript interpreter underwent an upgrade in late Spring 2000 and was released for public use during the Summer. It is generally referred to as the Summer 2000 release. Versions prior to Summer 2000 did not care about case-sensitivity of built-in property and method names. This was also the case with MSIE 3.0 The Summer 2000 version introduces support for user-defined properties and such like. This means that DHTML effects created by authoring tools such as DreamWeaver should work better in WebTV boxes that are shipped after this date or are upgraded in the field. Event handling support is improved in the latest release. Earlier versions had problems with event handlers that had not yet completed their execution after 10 seconds. The WebTV documentation still suggests that the Window.onunload event handler is not used. The javascript: URL format can be used with the minor limitation that it cannot be typed manually by the user. Anonymous functions are properly supported by the WebTV set-top box from the Summer 2000 release onwards. Earlier versions of this product only partially supported anonymous functions. Referring to page element objects by their names is more flexible. Versions of WebTV prior to the Summer 2000 release required that the references were fully qualified. This is still recommended but the JellyScript interpreter is now more forgiving, along the lines of the JScript interpreter in the MSIE browser. Some care still needs to be taken when building web pages for use in cross browser situations.
1220
J – JellyScript (Definition)
Security was enhanced in the Summer 2000 release. This is now correctly implemented inline with the rules of access to window content from different domains. The screen property was added to the Window object and contains a reference to the Screen object that describes the size and attributes of the TV display screen. The Window.open() method will behave differently in JellyScript when compared with the behavior in a normal computer-based web browser. It creates a pseudo window in an IFRAME and appends it to the end of the current display. The user can then scroll down to this window. On the whole this behavior is so different to the normal Window.open() usage that it is probably best to avoid using it. The Summer 2000 release of JellyScript now supports full double-precision math routines. Date object support is now up to ECMA standard specifications with full support for all properties and methods. The identity (===) and non identity (!==) operators are also now supported (consistent with the support in the MSIE browser). There are some areas of functionality that are considered weak or are completely unsupported on this platform: ❑
Window.open()
❑
Regular Expression support
❑
Signed scripts
❑
Custom sort ordering
❑
Array sizes limited to 32768 elements
❑
Error handling is silent
Be careful when accessing form elements within a document. In fact you should generally fully qualify all references to objects within the page. This is mandatory with form elements, which should have the document object referred to as the first item in the hierarchy chain that describes the element's location in the DOM. You should also be careful when testing for browser types in the user agent string. Eliminate the possibility of the browser being a WebTV box before testing for the Netscape browser. If you don't, then it is likely you will test true for being a Netscape browser even when executing the JavaScript code on a WebTV box. You will need to scan the entire user agent string. To parse out the string "WebTV" it might be worth converting to lowercase first to increase your chances of a match. See also:
TV Set-top boxes, WebTV
Web-references: This link leads to a useful WebTV JavaScript guide, for interested parties. http://developer.webtv.net/authoring/javascript/javascript.htm
1221
JavaScript Programmer's Reference
.js (File extension) JavaScript include file. You can include external shared fragments of JavaScript into a web page by calling in a .js file. A .js file simply contains that JavaScript which would have been placed inside a <SCRIPT> tag. In the case of the Netscape browser, it can store configuration and preferences data in .js files. These .js files can also be used server-side with Netscape Enterprise Server. They can be compiled with the LiveWire JavaScript compiler and linked with the HTML to create .web files that Netscape Enterprise Server can deliver very quickly to a requesting client browser. The MIME type for a .js file used to be application/x-javascript but is now text/javascript. Either should work but text/javascript is preferred. This may necessitate you carrying out some server configuration changes if you don't already serve this kind of file. The file is included by specifying its URL with the SRC="..." HTML tag attribute. You must also include a closing tag because <SCRIPT> is a block level item.
Example code: <SCRIPT SRC="http://www.mydomain.com/include.js">
See also:
<SCRIPT ARCHIVE="...">, <SCRIPT SRC="...">, File extensions, Preferences, Source files, Web browser
Cross-references: O'Reilly JavaScript Definitive Guide – page 215 Wrox Instant JavaScript – page 3
.jsc (File extension) JavaScript configuration file. See also:
1222
netscape.lck, Preferences
J – JScript version (Standard)
JScript version (Standard) The version history for JScript. Microsoft added scripting capabilities to version 3.0 of the MSIE browser. The JScript interpreter is perhaps named differently so that detractors would not accuse Microsoft of modifying the JavaScript language. Version 1.0 of JScript was also available in Internet Information Server as well as the MSIE version 3.0 browser. That first version of JScript is broadly compatible with JavaScript version 1.0 although there are differences between them: Interpreter
ECMA
Notes
JScript 1.0
No
Equivalent to JavaScript 1.0 and released with MSIE 3.0
JScript 1.1
No
Never released
JScript 1.2
No
Evidence of its existence but status unknown
JScript 2.0
No
Released with IIS 1.0
JScript 3.0
Yes
Equivalent to JavaScript 1.2 and released with MSIE 4.0, IIS 4.0 and WSH 1.0 (some features are in MSIE 3.02)
JScript 4.0
Yes
Released with Visual Studio 6.0
JScript 5.0
Yes
Equivalent to JavaScript 1.5 and supported on all 32 bit Windows operatings systems with MSIE.
JScript 5.1
Yes
Released with IIS 5.0 on Windows 2000
JScript 5.5
Yes
Released with MSIE 5.5
The JScript support in MSIE is excellent. However, if you limit yourself purely to the JavaScript sub-set, there are some limitations in the support. The language has been extended somewhat but not in the same way as Netscape Communications Inc provided enhancements to their interpreter. If the JScript interpreter is reinstalled without upgrading the browser, you may be using a version of JScript that is later than the browser. Scripts should work normally as long they do not exploit features of Jscript that have changed. However, the scripts may not be able to access some new features of the later version. For example, JScript 5.5 can be installed over the top of JScript 5.0 in a version 5.0 MSIE browser. You get the later core language features but continue to use the old document model. This can get utterly confusing for script developers. See also:
History, Internet Explorer, JavaScript version
Cross-references: Wrox Instant JavaScript – page 3
1223
JavaScript Programmer's Reference
.jse (File extension) Nombas ScriptEase source file. See also:
File extensions, Nombas ScriptEase, Standalone JavaScript
.jsh (File extension) Nombas ScriptEase include file. See also:
File extensions, Nombas ScriptEase, Standalone JavaScript
JSObject object (Java class) A Java class that encapsulates JavaScript objects for access from Java code. Availability:
JavaScript – 1.1 Netscape – 3.0
JavaScript syntax:
N
Class methods: Object methods:
myJSObject = netscape.javascript.JSObject
getWindow() call(), eval(), getMember(), getSlot(), removeMember(), setMember(), setSlot(), toString()
This Java class is otherwise known as netscape.javascript.JSObject (to give it its full name within the Java context). This provides a way for Java code to interact fully with the JavaScript native environment. JSObject is a sub-class of the generic Object class within Java. Its public interface defines the following methods and properties: ❑
getWindow()
❑
getMember()
❑
getSlot()
❑
setMember()
❑
setSlot()
❑
removeMember()
❑
call()
❑
eval()
❑
toString()
Note that these are hooks to Java methods although they may look like JavaScript methods. When member properties and slot values are accessed from arrays, you get an Object object returned. If this object is really a JavaObject, then it will be unwrapped and the encapsulated Java object will be returned without its JavaScript wrapper. It will still be returned as an Object object but it can then be cast to a native Java object type rather than another JSObject.
1224
J – JSObject.call() (Java method)
The setMember() and setSlot() methods perform the converse although there are some subtle limitations. Your Java development environment should give you plenty of help with the compilation of applets. The key point is that you have a copy of the netscape.javascript.JSObject class available for the applet to be linked against. This may involve setting your CLASSPATH to defined where the Java classes are located. The file you need may be browser version specific. In Netscape Navigator version 4.0, the file is called java40.jar but it may be named differently in other versions. Where it is located also may depend on how and where you installed Netscape. See also:
Java calling JavaScript, Java to JavaScript values, JavaScript embedded in Java, JavaScript to Java values, JSObject.call(), JSObject.eval(), JSObject.getMember(), JSObject.getSlot(), JSObject.getWindow(), JSObject.removeMember(), JSObject.setMember(), JSObject.setSlot(), JSObject.toString(), LiveConnect, MAYSCRIPT, netscape.javascript.JSObject
Method
JavaScript
JScript
N
IE
Opera
Notes
call() eval() getMember() getSlot() removeMember() setMember() setSlot() toString()
1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 +
-
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 +
-
-
-
Cross-references: O'Reilly JavaScript Definitive Guide – page 8-570 Wrox Professional JavaScript – page 544
JSObject.call() (Java method) Calls a method in the JavaScript object from the Java environment. Availability:
JavaScript – 1.1 Netscape – 3.0
Property/method value type:
Object object
1225
JavaScript Programmer's Reference
Java syntax: Argument list:
myJSObject.call("aMethod", anArgArray) aMethod
The name of a method to call.
anArgArray
An array of arguments to pass to the method
This is the way in which a Java applet can call back to a JavaScript function in a page. Once you know the window, you can invoke methods that belong to it as well as access properties. This will always yield an Object object as a result. There are quite restricted Java to JavaScript limitations on passing non-primitive values in the arguments array. The values passed to JavaScript will conform to the following conversions as they are passed to the JSObject methods: Java
JavaScript
java.lang.Boolean
JavaObject object
java.lang.Double
JavaObject object
java.lang.Integer
JavaObject object
java.lang.String
JavaObject object
netscape.javascript.JSObject
generic JavaScript object
all other Java objects
JavaObject object
The return values will conform to the following conversions as they are passed between the environments: JavaScript
Java
boolean primitive
java.lang.Boolean
number primitive
java.lang.Double
string primitive
java.lang.String
JavaObject object
The encapsulated Java object unwrapped
all other JavaScript objects
netscape.javascript.JSObject
The result of this method call will be an Object object which needs to be cast to some other value for use in the Java environment. See also:
Call, Java to JavaScript values, JavaScript to Java values, JSObject object, JSObject.eval(), LiveConnect
Cross-references: Wrox Professional JavaScript – page 542-3
1226
J – JSObject.eval() (Java method)
JSObject.eval() (Java method) A means of invoking native JavaScript eval() functionality. Availability:
JavaScript – 1.1 Netscape – 3.0
Java syntax:
myJSObject.eval("someScript")
Argument list:
someScript
Some valid JavaScript source
This is a much simpler way to execute JavaScript than by the call() method. Here there is no need to construct an array to pass in the method arguments. The return values will conform to the following conversions as they are passed between the environments: JavaScript
Java
boolean primitive
java.lang.Boolean
number primitive
java.lang.Double
string primitive
java.lang.String
JavaObject object
The encapsulated Java object unwrapped
all other JavaScript objects
netscape.javascript.JSObject
The JSObject.eval() method eliminates many of the parameter passing problems associated with the JSObject.call() method as far as type conversion is concerned. You will need to convert any parameters you want to pass into strings, but this does allow you to pass primitive values which you simply cannot do with the JSObject.call() method. See also:
Eval code, eval(), JavaScript to Java values, JSObject object, JSObject.call(), LiveConnect
JSObject.getMember() (Java method) Returns the value of a named property of the object belonging to a JavaScript object to a calling in the Java environment. Availability:
JavaScript – 1.1 Netscape – 3.0
Property/method value type:
Object object
Java syntax:
myJSObject.getMember("aMemberName")
Argument list:
aMemberName
The name of a property belonging to the JSObject
1227
JavaScript Programmer's Reference
As you read properties of JSObjects, you get more JSObjects returned. In this way, you can walk the document hierarchy to locate any item in the window referred to by the root JSObject. The return values will conform to the following conversions as they are passed between the environments: JavaScript
Java
boolean primitive number primitive string primitive JavaObject object all other JavaScript objects
java.lang.Boolean java.lang.Double java.lang.String The encapsulated Java object unwrapped netscape.javascript.JSObject
The result of this method call will be an Object object which needs to be cast to some other value for use in the Java environment. See also:
JavaScript to Java values, JSObject object, LiveConnect
JSObject.getSlot() (Java method) A means of accessing elements within an array encapsulated in a JSObject. Availability:
JavaScript – 1.1 Netscape – 3.0
Property/method value type:
Object object
Java syntax:
myJSObject.getSlot(anIndex)
Argument list:
anIndex
The array index equivalent to [anIndex]
This is a means of accessing array elements in JavaScript arrays when they are encapsulated inside a JSObject. The return values will conform to the following conversions as they are passed between the environments: JavaScript
Java
boolean primitive number primitive string primitive JavaObject object all other JavaScript objects
java.lang.Boolean java.lang.Double java.lang.String The encapsulated Java object unwrapped netscape.javascript.JSObject
The result of this method call will be the element of the array at the slot location returned as an Object object which needs to be cast to some other value. See also:
1228
JavaScript to Java values, JSObject object, LiveConnect
J – JSObject.getWindow() (Java static method)
JSObject.getWindow() (Java static method) A static method to return a new JSObject that belongs to the window containing the applet. Availability:
JavaScript – 1.1 Netscape – 3.0
Property/method value type:
JSObject object
JavaScript syntax:
N
Java syntax:
myJSObject.getWindow(anApplet)
Argument list:
anApplet
new JSObject(anApplet)
The applet whose window is to be referenced by the new JSObject
When called from a Java applet, this method returns a new JSObject for the window containing the applet. This is a way of creating a JSObject that relates to the correct window, that is, the one containing the applet. This factory method is called because there is no constructor for the JSObject class. It creates a JSObject appropriate for the applet whose reference is passed in its only parameter.
Example code: // Create a JSObject for the applet we are running in JSObject myJSObject = JSObject.getWindow(this);
See also:
JSObject object, LiveConnect
JSObject.removeMember() (Java method) Remove a property from a JavaScript object. Availability:
JavaScript – 1.1 Netscape – 3.0
Java syntax:
myJSObject.removeMember()
This is equivalent to the delete property mechanism in JavaScript. See also:
delete, JSObject object, LiveConnect
1229
JavaScript Programmer's Reference
JSObject.setMember() (Java method) Stores a new value in a property. Availability:
JavaScript – 1.1 Netscape – 3.0
Java syntax:
myJSObject.setMember("aName", "aValue")
Argument list:
aName aValue
The name of the property to be changed The new value to be stored in the property
This method allows the Java code to set a property of a JSObject to a new value There is a minor limitation in that you must pass a Java object and cannot set a primitive value. The values passed to JavaScript will conform to the following conversions as they are passed to the JSObject methods: Java
JavaScript
java.lang.Boolean
JavaObject object
java.lang.Double
JavaObject object
java.lang.Integer
JavaObject object
java.lang.String
JavaObject object
netscape.javascript.JSObject
generic JavaScript object
all other Java objects
JavaObject object
See also:
Java to JavaScript values, JSObject object, LiveConnect
JSObject.setSlot() (Java method) Store an element in the JavaScript array. Availability:
JavaScript – 1.1 Netscape – 3.0
Java syntax:
myJSObject.setSlot(anIndex, "aValue")
Argument list:
anIndex
The array index equivalent to [anIndex].
aValue
The new value to be stored in the array element
This method allows the Java code to set an element of a JavaScript array stored in a JSObject. There is a minor limitation in that you must pass a Java object and cannot set a primitive value.
1230
J – JSObject.toString() (Java method)
The values passed to JavaScript will conform to the following conversions as they are passed to the JSObject methods: Java
JavaScript
java.lang.Boolean
JavaObject object
java.lang.Double
JavaObject object
java.lang.Integer
JavaObject object
java.lang.String
JavaObject object
netscape.javascript.JSObject
generic JavaScript object
all other Java objects
JavaObject object
See also:
Java to JavaScript values, JSObject object, LiveConnect
JSObject.toString() (Java method) Converts the object to a string value. Availability:
JavaScript – 1.1 Netscape – 3.0
Java syntax:
myJSObject.toString()
The string equivalent value of the object is returned as a Java String. See also:
JavaScript to Java values, JSObject object, LiveConnect, ToString, Type conversion
JSS (Definition) A standard for describing style sheets in Netscape 4.0.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
JavaScript Style Sheets
1231
JavaScript Programmer's Reference
JSSClasses object (Object/JSS) A collection of JavaScript Style Sheet classes. Availability:
JavaScript – 1.2 Netscape – 4.0 Deprecated
JavaScript syntax:
N
Object properties:
className
myJSSClasses = myDocument.classes
This style sheet control mechanism is becoming deprecated as it is only supported on Netscape 4.0 and will not be ratified by a W3C standard. It is not recommended that you use these facilities in new projects. This object is somewhat like an array in that it contains a collection of objects that can be accessed associatively by name. However, unlike an array, it does not respond to the length property request. Also unlike an array, you cannot access its members using index values. The only meaningful property of this object is one of its array elements corresponding to a named class in the style sheet. That property is also associated with a named attribute of an HTML tag in the document. You cannot enumerate this object to inspect its properties.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Document.classes[]
Property
JavaScript
JScript
N
IE
Opera
Notes
className
1.2 +
-
4.0 +
-
-
WarningDeprecated
Property attributes: DontEnum.
1232
J – JSSClasses.className (Property)
JSSClasses.className (Property) A JSS object corresponding to a single style class. Availability:
JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
JSSTags object
JavaScript syntax:
N
myDocument.classes.aClassName
Argument list:
aClassName
A named class within the style sheet
This object represents a class within the style sheet. However it is only available in Netscape 4.0 and is a means of access that leads ultimately to a Style object. This mechanism is radically different to and much more complex than the simple style property belonging to an Element object in MSIE and Netscape 6.0. From the value in this property, you would traverse the style tree down another level to find a style collection relating to a particular tag. You cannot enumerate this object to inspect its properties. This was mainly provided to give access to a style definition in Netscape 4.0 as opposed to the way it is used in MSIE and Netscape 6.0, where it is used to apply a style definition to a styled element within the document.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0.
JSSTag object (Object/JSS) A single style object for use in Netscape 4. Availability: JavaScript syntax:
JavaScript – 1.2 Netscape – 4.0 Deprecated myJSSTag = N myDocument.classes.aClassName.aTagName myJSSTag = myDocument.contextual(...) N
N
myJSSTag = myDocument.ids.anElementName myJSSTag = myDocument.tags.aTagName
N
myJSSTag = myJSSTags.aTagName
N
1233
JavaScript Programmer's Reference
Argument list:
aClassName
A named class within the style sheet
anElementName
The value of a NAME="..." or ID="..." tag attribute.
aTagName Object properties:
Object methods:
The name of an HTML tag align, apply, background, backgroundColor, backgroundImage, bgColor, borderBottomWidth, borderColor, borderLeftWidth, borderRightWidth, borderStyle, borderTopWidth, clear, clip, color, display, fontFamily, fontSize, fontStyle, fontWeight, height, left, lineHeight, listStyleType, marginBottom, marginLeft, marginRight, marginTop, paddingBottom, paddingLeft, paddingRight, paddingTop, textAlign, textDecoration, textIndent, textTransform, top, verticalAlign, visibility, whiteSpace, width, zIndex borderWidths(), margins(), paddings(), rgb()
This is the Netscape 4.0 JSS equivalent of the DOM style object. You assign values to the properties of this object to define the styles according to the JSS rules. Browsers sometimes use different object types with incompatible properties and methods to represent the same thing. We cover them as distinctly different objects where it seems sensible. The Netscape 4.0 style settings are properties of a JSSTag object. Refer to the style object for details of the MSIE and Netscape 6.0 style control properties. The property values for this object each represent a style attribute of an HTML tag. To define a style setting with JSS, assign a value to this property according to the class name and tag name hierarchy. These values are write-only and must be defined in the of the document. You cannot read them back or change them after the has commenced loading. You cannot enumerate the properties of this object so it is impossible to inspect them. Indeed, after repeated attempts to access them, they appear to be write-only properties. Because you can only define them during the of a document, they don't provide much helpful facilities as regards dynamic style control. It is highly recommended that you refrain from using these JSS facilities in any new projects. They are deprecated now that Netscape 6.0 adopts a more standardized DOM based approach to style settings. The CSS support in Netscape 4.0 is available up to CSS level 1. In MSIE and Netscape 6.0, much of CSS level 2 is available through its more sophisticated and easier to manage style model.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
1234
Document.contextual(), JSSTags object, style object (2)
J – JSSTag object (Object/JSS)
Property
JavaScript
JScript
N
IE
Opera
Notes
align
1.2 +
-
4.0 +
-
-
Warning, Deprecated
apply
1.2 +
-
4.0 +
-
-
Warning, Deprecated
background
1.2 +
-
4.0 +
-
-
Warning, DontEnum., Deprecated
backgroundColor
1.2 +
-
4.0 +
-
-
Warning, Deprecated
backgroundImage
1.2 +
-
4.0 +
-
-
Warning, Deprecated
bgColor
1.2 +
-
4.0 +
-
-
Warning, DontEnum., Deprecated
borderBottomWidth
1.2 +
-
4.0 +
-
-
Warning, Deprecated
borderColor
1.2 +
-
4.0 +
-
-
Warning, Deprecated
borderLeftWidth
1.2 +
-
4.0 +
-
-
Warning, Deprecated
borderRightWidth
1.2 +
-
4.0 +
-
-
Warning, Deprecated
borderStyle
1.2 +
-
4.0 +
-
-
Warning, Deprecated
borderTopWidth
1.2 +
-
4.0 +
-
-
Warning, Deprecated
clear
1.2 +
-
4.0 +
-
-
Warning, Deprecated
clip
1.2 +
-
4.0 +
-
-
Warning, DontEnum., Deprecated
color
1.2 +
-
4.0 +
-
-
Warning, Deprecated
display
1.2 +
-
4.0 +
-
-
Warning, Deprecated
fontFamily
1.2 +
-
4.0 +
-
-
Warning, Deprecated
fontSize
1.2 +
-
4.0 +
-
-
Warning, Deprecated
fontStyle
1.2 +
-
4.0 +
-
-
Warning, Deprecated
fontWeight
1.2 +
-
4.0 +
-
-
Warning, Deprecated
height
1.2 +
-
4.0 +
-
-
Warning, Deprecated
left
1.2 +
-
4.0 +
-
-
Warning, DontEnum., Deprecated
lineHeight
1.2 +
-
4.0 +
-
-
Warning, Deprecated
listStyleType
1.2 +
-
4.0 +
-
-
Warning, Deprecated
marginBottom
1.2 +
-
4.0 +
-
-
Warning, Deprecated
marginLeft
1.2 +
-
4.0 +
-
-
Warning, Deprecated
marginRight
1.2 +
-
4.0 +
-
-
Warning, Deprecated
marginTop
1.2 +
-
4.0 +
-
-
Warning, Deprecated
paddingBottom
1.2 +
-
4.0 +
-
-
Warning, Deprecated
paddingLeft
1.2 +
-
4.0 +
-
-
Warning, Deprecated
paddingRight
1.2 +
-
4.0 +
-
-
Warning, Deprecated
paddingTop
1.2 +
-
4.0 +
-
-
Warning, Deprecated
textAlign
1.2 +
-
4.0 +
-
-
Warning, Deprecated
textDecoration
1.2 +
-
4.0 +
-
-
Warning, Deprecated
textIndent
1.2 +
-
4.0 +
-
-
Warning, Deprecated
Table continued on following page
1235
JavaScript Programmer's Reference
Property
JavaScript
JScript
N
IE
Opera
Notes
textTransform
1.2 +
-
4.0 +
-
-
Warning, Deprecated
top
1.2 +
-
4.0 +
-
-
Warning, DontEnum., Deprecated
verticalAlign
1.2 +
-
4.0 +
-
-
Warning, Deprecated
visibility
1.2 +
-
4.0 +
-
-
Warning, DontEnum., Deprecated
whiteSpace
1.2 +
-
4.0 +
-
-
Warning, Deprecated
width
1.2 +
-
4.0 +
-
-
Warning, Deprecated
zIndex
1.2 +
-
4.0 +
-
-
Warning, DontEnum., Deprecated
Method
JavaScript
JScript
N
borderWidths()
1.2 +
-
4.0 +
-
-
-
-
-
1+
-
Warning, Deprecated
margins()
1.2 +
-
4.0 +
-
-
-
-
-
1+
-
Warning, Deprecated
paddings()
1.2 +
-
4.0 +
-
-
-
-
-
1+
-
Warning, Deprecated
rgb()
1.2 +
-
4.0 +
-
-
-
-
-
-
-
Warning, Deprecated
IE Opera NES ECMA DOM CSS HTML
Notes
Property attributes: DontEnum.
JSSTag.align (Property) Specified the alignment of objects. Availability:
JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.align
N
myJSSTag.align = aValue
CSS syntax:
float
HTML syntax:
Argument list:
aValue
1236
An alignment value
J – JSSTag.apply (Property)
The JSSTag.align property does not correspond to any CSS property as there is not a specific align property in CSS even though some HTML 4.0 tags do. It is based on values that are specified with HTML ALIGN="..." tag attributes. The alignment of the styled object with respect to its containing parent object is defined in this property. The folllowing expected and widely available set of alignment specifiers are available: ❑
absbottom
❑
absmiddle
❑
baseline
❑
bottom
❑
center
❑
left
❑
middle
❑
right
❑
texttop
❑
top
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0.
JSSTag.apply (Property) A special JSS supporting property that holds a reference to a callback function. Availability:
JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
Function object
JavaScript syntax:
N
myTags.anItem.apply = aHandler
aHandler
A JavaScript function to call when setting the object's style
anItem
A tag name such as P or B or H1
Argument list:
This is a mechanism that allows the style engine in Netscape 4.0 to call for help when things get too complicated. Basically it calls the handler when an object is created and that handler sets the properties of the receiving object. There is an implied this on the front of any property names that are assigned with new values.
1237
JavaScript Programmer's Reference
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0 See also:
JavaScript Style Sheets
JSSTag.backgroundColor (Property) The background color for objects. Availability:
Property/method value type: JavaScript syntax:
CSS syntax: HTML syntax: Argument list:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated String primitive N
myJSSTag.backgroundColor
N
myJSSTag.backgroundColor = "transparent"
myJSSTag.backgroundColor = aColor N background-color: aColorbackground-color: transparent aColor
color value specified as #numeric or color name
The JSSTag.backgroundColor property corresponds to the background-color CSS property. This property controls the background color of the element. The value should be a color specified using the normal numeric or symbolic name notation. In addition, the value "transparent" can be specified to allow the background to be "see-through". The default value is "transparent". This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
1238
style.backgroundColor
J – JSSTag.backgroundImage (Property)
JSSTag.backgroundImage (Property) The URL of a background image for an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.backgroundImage
N
myJSSTag.backgroundImage = "none"
N
myJSSTag.backgroundImage = aURL
CSS syntax:
background-image: aURL
HTML syntax:
Argument list:
aURL
A URL that points at an image
The JSSTag.backgroundImage property corresponds to the background-image CSS property. This property is used to specify the URL of an image file to be loaded and used as the background. Alternatively the value "none" can be specified to deactivate the image background. The default value for this property is "none". This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Background.src, style.backgroundImage
1239
JavaScript Programmer's Reference
JSSTag.borderBottomWidth (Property) The thickness of the bottom edge of border round objects. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.borderBottomWidth
N
myJSSTag.borderBottomWidth = aWidth
CSS syntax:
border-bottom-width: aWidth
HTML syntax:
Argument list:
aWidth
A CSS length value
The JSSTag.borderBottomWidth property corresponds to the border-bottom-width CSS property. The content of an object is enclosed in a bounding extent rectangle. Around this is placed a padding space controlled by the padding parameters. The padding expands the bounding. Then the border is placed around this. The border width increases the bounding rectangle around the object still further. Last of all the margin is placed around the outside. This forms a rectangle that is used to locate the object adjacent to any other objects or page margins. The value of this property can be specified as follows: ❑
thin
❑
medium
❑
thick
It can also be specified with a length value in one of several units of measure. The initial value is set to "medium". This value is not inherited from its parent container element.
Object
1240
Padding
Padding bottom
Border
Border bottom width
Margin
Margin bottom
J – JSSTag.borderColor (Property)
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units
JSSTag.borderColor (Property) The color of the border around objects. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.borderColor
N
myJSSTag.borderColor = aColor
CSS syntax:
border-color: aColor
HTML syntax:
Argument list:
aColor
color value specified as #numeric or color name
The JSSTag.borderColor property corresponds to the border-color CSS property. This property controls the color of all four borders of the object. The value is a color specified in the normal numeric or symbolically named fashion. The initial value is taken from the color property of the element around which the border is placed. This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
style.borderColor
1241
JavaScript Programmer's Reference
JSSTag.borderLeftWidth (Property) The thickness of the left edge of the border around objects. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.borderLeftWidth
N
myJSSTag.borderLeftWidth = aWidth
CSS syntax:
border-left-width: aWidth
HTML syntax:
Argument list:
aWidth
A CSS length value
The JSSTag.borderLeftWidth property corresponds to the border-left-width CSS property. Refer to the JSSTag.borderBottomWidth topic for details. This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units
JSSTag.borderRightWidth (Property) The thickness of the right edge of the border around objects. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.borderRightWidth
N
myJSSTag.borderRightWidth = aWidth
CSS syntax:
1242
border-right-width: aWidth
J – JSSTag.borderStyle (Property)
HTML syntax:
Argument list:
aWidth
A CSS length value
The JSSTag.borderRightWidth property corresponds to the border-right-width CSS property. Refer to the JSSTag.borderBottomWidth topic for details. This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units
JSSTag.borderStyle (Property) The type of line used for the border around objects. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.borderStyle
N
myJSSTag.borderStyle = aStyle
CSS syntax:
border-style: aStyle
Argument list:
aStyle
A border style value
The JSSTag.borderStyle property corresponds to the border-style CSS property. The following style values can be applied to borders with this property: ❑
none
❑
hidden
❑
dotted
❑
dashed
❑
solid
❑
double
❑
groove
❑
ridge
1243
JavaScript Programmer's Reference
❑
inset
❑
outset
The initial value for this property is "none". This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
style.borderStyle
JSSTag.borderTopWidth (Property) The thickness of the top edge of the border around objects. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.borderTopWidth
N
myJSSTag.borderTopWidth = aWidth
CSS syntax:
border-top-width: aWidth
HTML syntax:
Argument list:
aWidth
A CSS length value
The JSSTag.borderTopWidth property corresponds to the border-top-width CSS property. Refer to the JSSTag.borderBottomWidth topic for details. This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
1244
Measurement units
J – JSSTag.borderWidths() (Method)
JSSTag.borderWidths() (Method) Sets all of the border width values for an object. Availability:
JavaScript syntax:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated myJSSTag.borderWidths(aTop, aHoriz, aBottom) N N
myJSSTag.borderWidths(aTop, aRight, aBottom, aLeft)
N
myJSSTag.borderWidths(aValue)
CSS syntax:
myJSSTag.borderWidths(aVert, aHoriz) N border-width: aTop, aHoriz, aBottomborder-width: aTop, aRight, aBottom, aLeftborder-width: aValueborder-width: aVert, aHorizborder: aValue
HTML syntax:
Argument list:
Event handlers:
aBottom
A border width applied at the bottom
aHoriz
A border width applied left and right
aLeft
A border width applied to the left
aRight
A border width applied to the right
aTop
A border width applied at the top
aValue
A border width value applied all round
aVert
A border width applied top and bottom
This controls the border attribute of an image objects
This method provides a way to set all four border width values at once. The number of arguments is variable and the values are applied in different ways according to how many are supplied.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
style.borderWidth
Event name
JavaScript
JScript
This controls the border attribute of an image object.
1.2 +
-
N 4.0 +
IE Opera NES ECMA DOM CSS HTML
Notes
-
Warning, Deprecated
-
-
-
-
1+
-
1245
JavaScript Programmer's Reference
JSSTag.clear (Property) A property that clears the style and forces the object to be displayed below a left or right aligned image. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.clear
N
myJSSTag.clear = aControl
CSS syntax:
clear: aControl
HTML syntax:
Argument list:
aControl
a clear control value
The JSSTag.clear property corresponds to the clear CSS property. This property is used to control the floating elements around the element to which the styling applies. Clearing the float attribute to one side or the other forces a line break on that side and will not allow floating elements to flow into an adjacent position. The following values are permitted: ❑
none
❑
left
❑
right
❑
both
The default value for this property is "none". This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
1246
style.clear
J – JSSTag.color (Property)
JSSTag.color (Property) A foreground color for an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape Navigator version – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.color
N
myJSSTag.color = aColor
CSS syntax:
color: aColor
HTML syntax:
Argument list:
aColor
color value specified as #numeric or color name
The JSSTag.color property corresponds to the color CSS property. This property controls the foreground color of text in the element. The value should be a color specified using the normal numeric or symbolic name notation. The default value depends on the settings in the user preferences of the user agent (the browser). This value is inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
color names, color value, style.color
JSSTag.display (Property) Controls the display visibility of an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.display
N
myJSSTag.display = aControl
CSS syntax:
display: aControl
Argument list:
aControl
a display control value
1247
JavaScript Programmer's Reference
The JSSTag.display property corresponds to the display CSS property. This property controls the way that a styled element is displayed on-screen. It can cause the element to appear as a block item, something that is inline, a list or other possibilities. The following values are accepted: ❑
inline
❑
block
❑
list-item
❑
run-in
❑
compact
❑
marker
❑
table
❑
inline-table
❑
table-row-group
❑
table-header-group
❑
table-footer-group
❑
table-row
❑
table-column-group
❑
table-column
❑
table-cell
❑
table-caption
❑
none
Elements having the display property set to "block" will be forced to start on a new line. The "inline" value keeps items running together on the same line. Setting the display property to "none" will completely hide an item. The other property values are quite complex and beyond the scope of our coverage here and are documented thoroughly in other works that specifically cover the CSS presentation styling standard. In any case, the whole JSS style complex is deprecated and will likely fall into disuse. The default value for this property is "inline". This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
1248
style.display
J – JSSTag.fontFamily (Property)
JSSTag.fontFamily (Property) The font family or typeface name for an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.fontFamily
N
myJSSTag.fontFamily = aFontList
CSS syntax:
font-family: aFontList
HTML syntax:
Argument list:
aFontList
A list of one or more font names
The JSSTag.fontFamily property corresponds to the font-family CSS property in a style sheet. It allows you to select a font for use in the object within the document. Some example values of specific font families are listed below: ❑
Arial
❑
Courier
❑
Times
❑
Garamond
❑
Palatino
❑
Helvetica
❑
"New Century Schoolbook"
Font names containing spaces will need to be enclosed in quotes. These are generic family names and allow the browser to choose its own best matching font: ❑
serif
❑
sans-serif
❑
monospace
❑
cursive
❑
fantasy
You should provide your list of fonts as a comma separated list with the most preferred fonts to the left. The default value for this property depends on the browser font settings in the user preferences. This value is inherited from its parent container element.
1249
JavaScript Programmer's Reference
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
style.fontFamily
JSSTag.fontSize (Property) The font size for an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.fontSize
N
myJSSTag.fontSize = aSizeValue
CSS syntax:
font-size: aSizeValue
HTML syntax:
Argument list:
aSizeValue
A size value as described
The JSSTag.fontSize property corresponds to the font-size CSS property. It controls the size of the text as it appears on the screen. This is notoriously unportable and text always looks smaller on a Macintosh than it does on a Windows system. This is because the native screen resolution of a Macintosh is 72 dpi and a Windows system is 96 dpi. You can specify the size in a variety of ways. There are four classifications for the font size value: ❑
Length
❑
Percentage
❑
Absolute size
❑
Relative size
The length value can be specified in units of measure as follows: Points – e.g. 12pt Millimetres – e.g. 0.4mm Pixels – e.g. 16px The percentage value is computed relative to the enclosing object's corresponding property (hence the cascading effect of style sheets). A percentage value is indicated with an integer followed by a percent sign, for example 120%.
1250
J – JSSTag.fontStyle (Property)
The absolute size is based on the browser knowing the screen display resolution and computing some preferred font sizes. It is specified using the following keywords: ❑
xx-small
❑
x-small
❑
small
❑
medium
❑
large
❑
x-large
❑
xx-large
Note that some of the smaller sizes render so small on a Macintosh as to be unreadable. The relative sizing is controlled by the two keywords: ❑
larger
❑
smaller
You can use a combination of absolute and relative sizing or any combination of sizes as this property is cascaded down through the styles. The default value for this property is "medium". This value is inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units, style.fontSize
JSSTag.fontStyle (Property) The font attributes for an object. Availability:
Property/method value type: JavaScript syntax: CSS syntax: Argument list:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated String primitive N
myJSSTag.fontStyle
myJSSTag.fontStyle = aStyle N font-style: aStyle aStyle
A font presentation style
The JSSTag.fontStyle property corresponds to the CSS font-style property.
1251
JavaScript Programmer's Reference
You can choose a value from these available styles: ❑
normal
❑
italic
❑
oblique
For some fonts, the italic and oblique fonts are simply slanted versions of the normal upright fonts. This can lead to some unattractive artefacts and so the italic form is sometimes specially designed and uses a markedly different glyph. It is intended to improve readability of italic characters. The default value for this property is "normal". This value is inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
style.fontStyle
JSSTag.fontWeight (Property) The weight of a font for an object. This is otherwise known as the boldness. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.fontWeight
N
myJSSTag.fontWeight = aWeight
CSS syntax:
font-weight: aWeight
HTML syntax:
Argument list:
aWeight
A font weight control value
The JSSTag.fontWeight property corresponds to the font-weight CSS property. This property controls the weight of the characters on the screen. this is sometimes called boldness although it provides a much finer level of control than simply using a bold tag. The following numerical values select a progressive weight increase: ❑
100
❑
200
❑
300
1252
J – JSSTag.height (Property)
❑
400
❑
500
❑
600
❑
700
❑
800
❑
900
These keywords select a pair of reasonably similar settings across platforms: ❑
normal
❑
bold
The normal setting is equivalent to 400 and the bold setting matches 700. In addition there are two relative boldness controls: ❑
bolder
❑
lighter
Not all font families support as wide a range of possible weights as the fontWeight property can control. Nevertheless, the browser makes its best efforts to deliver the requested appearance. The default value for this property is "normal". This value is inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units, style.fontWeight
JSSTag.height (Property) The height of an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.height
N
myJSSTag.height = aHeight
CSS syntax:
height: aHeight
1253
JavaScript Programmer's Reference
HTML syntax:
Argument list:
aHeight
Event handlers:
This controls the height of an image object on screen for example.
An object height value
The JSSTag.height property corresponds to the height CSS property. This property can be used to control the height of an object on the screen. The value can be specified as a length measured in units, a percentage of the containing block the element is located in or an "auto" value that lets the browser compute the size. The default value for this property is "auto". This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
JSSTag.width, style.height
JSSTag.lineHeight (Property) The line height spacing for an object. This is the distance between the baselines of two adjacent lines of text. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.lineHeight
N
myJSSTag.lineHeight = aLineHeight
CSS syntax:
line-height: aLineHeight
Argument list:
aLineHeight
A spacing between lines of text
The JSSTag.lineHeight property corresponds to the line-height CSS property. This value specifies the distance between the baselines for adjacent lines; more accurately, it indicates the minimum distance, because an object larger than the line height value will cause lines to be leaded further apart to accommodate the item within the display.
1254
J – JSSTag.listStyleType (Property)
The following values are meaningful in this property: ❑
A numeric line height measured in points
❑
A value in pixels
❑
A distance in mm
❑
A percentage of the parent line height value
The default value for this depends on the user preference settings for font sizes. This value is inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units, style.lineHeight
JSSTag.listStyleType (Property) A list style bullet selector for the object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.listStyleType
N
myJSSTag.listStyleType = aStyle
CSS syntax:
list-style-type: aStyle
HTML syntax:
Argument list:
aStyle
A list style control
The JSSTag.listStyleType property corresponds to the list-style-type CSS property. This is used to control the appearance of lists of items. It can have the following values: ❑
disc
❑
circle
❑
square
❑
decimal
❑
decimal-leading-zero
1255
JavaScript Programmer's Reference
❑
lower-roman
❑
upper-roman
❑
lower-alpha
❑
lower-latin
❑
upper-alpha
❑
upper-latin
❑
lower-greek
❑
hebrew
❑
armenian
❑
georgian
❑
cjk-ideographic
❑
hiragana
❑
katakana
❑
hiragana-iroha
❑
katakane-iroha
❑
none
The value "none" suppresses labels on the list. There are various graphic symbols. You can also number the list items using different documentation conventions (numbers, roman numerals, letters etc). There is also support for international character fonts and localization requirements. The default value for this property is "disc". This value is inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4 and is completely removed from Netscape 6.0. See also:
1256
style.listStyleType
J – JSSTag.marginBottom (Property)
JSSTag.marginBottom (Property) The margin at the bottom of an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.marginBottom
N
myJSSTag.marginBottom = aWidth
CSS syntax:
margin-bottom: aWidth
Argument list:
aWidth
A CSS length value
The JSSTag.marginBottom property corresponds to the margin-bottom CSS property. The content of an object is enclosed in a bounding extent rectangle. Around this is placed a padding space controlled by the padding parameters, which expands the bounding – the border is then placed around this. The border width increases the bounding rectangle around the object still further. Last of all the margin is placed around the outside. This forms a rectangle that is used to locate the object adjacent to any other objects or page margins. The value of this property can be specified as follows: ❑
A length value in one of several units of measure
❑
A percentage of the width of the object
In addition a keyword can be used: ❑
auto
The auto setting need not be applied to all of the margins, but according to how it is used, some fairly complex margin computation is applied. You should consult one of the standard texts on CSS styles. The initial value is set to 0 allowing for no margin value at all. This value is not inherited from its parent container element.
Object Padding
Padding bottom
Border
Border bottom width
Margin
Margin bottom
1257
JavaScript Programmer's Reference
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. Measurement units
See also:
JSSTag.marginLeft (Property) The margin at the left of an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.marginLeft
N
myJSSTag.marginLeft = aWidth
CSS syntax:
margin-left: aWidth
Argument list:
aWidth
A CSS length value
The JSSTag.marginLeft property corresponds to the margin-left CSS property. Refer to the JSSTag.marginBottom topic for details. This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units
JSSTag.marginRight (Property) The margin at the right of an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.marginRight
N
myJSSTag.marginRight = aWidth
1258
J – JSSTag.margins() (Method)
CSS syntax:
margin-right: aWidth
Argument list:
aWidth
A CSS length value
The JSSTag.marginRight property corresponds to the margin-right CSS property. Refer to the JSSTag.marginBottom topic for details. This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units
JSSTag.margins() (Method) Set all margin values for an object. Availability:
JavaScript syntax:
CSS syntax: Argument list:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated myJSSTag.margins(aTop, aHoriz, aBottom) N N
myJSSTag.margins(aTop, aRight, aBottom, aLeft)
N
myJSSTag.margins(aValue)
myJSSTag.margins(aVert, aHoriz) N margin: aTop, aHoriz, aBottommargin: aTop, aRight, aBottom, aLeftmargin: aValuemargin: aVert, aHoriz aBottom A margin applied at the bottom aHoriz
A margin applied left and right
aLeft
A margin applied to the left
aRight
A margin applied to the right
aTop
A margin applied at the top
aValue
A margin value applied all round
aVert
A margin applied top and bottom
This method provides a way to set all four margin values at once. The number of arguments is variable and the values are applied in different ways according to how many are supplied.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
JavaScript Style Sheets, style.margin
1259
JavaScript Programmer's Reference
JSSTag.marginTop (Property) The margin at the top of an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.marginTop
N
myJSSTag.marginTop = aWidth
CSS syntax:
margin-top: aWidth
Argument list:
aWidth
A CSS length value
The JSSTag.marginTop property corresponds to the margin-top CSS property. Refer to the JSSTag.marginBottom topic for details. This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units
JSSTag.paddingBottom (Property) The padding at the bottom of an object. Availability:
Property/method value type: JavaScript syntax: CSS syntax: Argument list:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated String primitive N
myJSSTag.paddingBottom
myJSSTag.paddingBottom = aWidth N padding-bottom: aWidth aWidth
A CSS length value
The JSSTag.paddingBottom property corresponds to the padding-bottom CSS property.
1260
J – JSSTag.paddingLeft (Property)
The content of an object is enclosed in a bounding extent rectangle. Around this is placed a padding space controlled by the padding parameters. The padding expands the bounding. Then the border is placed around this. The border width increases the bounding rectangle around the object still further. Last of all the margin is placed around the outside. This forms a rectangle that is used to locate the object adjacent to any other objects or page margins. The value of this property can be specified as follows: ❑
A length value in one of several units of measure
❑
A percentage of the width of the object
The initial value is set to 0 allowing for no padding value at all. This value is not inherited from its parent container element.
Object Padding
Padding bottom
Border
Border bottom width
Margin
Margin bottom
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units
JSSTag.paddingLeft (Property) The padding at the left of an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive Deprecated
JavaScript syntax:
N
myJSSTag.paddingLeft
N
myJSSTag.paddingLeft = aWidth
1261
JavaScript Programmer's Reference
CSS syntax:
padding-left: aWidth
Argument list:
aWidth
A CSS length value
The JSSTag.paddingLeft property corresponds to the padding-left CSS property. Refer to the JSSTag.paddingBottom topic for details. This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units
JSSTag.paddingRight (Property) The padding at the right of an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.paddingRight
N
myJSSTag.paddingRight = aWidth
CSS syntax:
padding-right: aWidth
Argument list:
aWidth
A CSS length value
The JSSTag.paddingRight property corresponds to the padding-right CSS property. Refer to the JSSTag.paddingBottom topic for details. This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
1262
Measurement units
J – JSSTag.paddings() (Method)
JSSTag.paddings() (Method) Set all padding values for an object. Availability:
JavaScript syntax:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated myJSSTag.paddings(aTop, aHoriz, aBottom) N N N
CSS syntax:
Argument list:
myJSSTag.paddings(aTop, aRight, aBottom, aLeft) myJSSTag.paddings(aValue)
myJSSTag.paddings(aVert, aHoriz) N padding: aTop, aHoriz, aBottompadding: aTop, aRight, aBottom, aLeftpadding: aValuepadding: aVert, aHoriz aBottom A padding applied at the bottom aHoriz
A padding applied left and right
aLeft
A padding applied to the left
aRight
A padding applied to the right
aTop
A padding applied at the top
aValue
A padding value applied all round
aVert
A padding applied top and bottom
This method provides a way to set all four padding values at once. The number of arguments is variable and the values are applied in different ways according to how many are supplied.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
style.padding
JSSTag.paddingTop (Property) The padding at the top of an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.paddingTop
N
myJSSTag.paddingTop = aWidth
CSS syntax:
padding-top: aWidth
Argument list:
aWidth
A CSS length value
1263
JavaScript Programmer's Reference
The JSSTag.paddingTop property corresponds to the padding-top CSS property. Refer to the JSSTag.paddingBottom topic for details. This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units
JSSTag.rgb() (Method) A JSS style control method. Availability: JavaScript syntax: Argument list:
JavaScript – 1.2 Netscape – 4.0 myTags.anItem.rgb(aRed, aGreen, N aBlue) aBlue Blue intensity value aGreen
Green intensity value
anItem
A tag name such as P or B or H1
aRed
Red intensity value
The rgb() method provides a convenient way to define an RGB triplet in a single call.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0.
Example code: // Some red texttags.P.rgb(255, 0, 0);
See also:
Cross-references: Wrox Instant JavaScript – page 50
1264
JavaScript Style Sheets
J – JSSTag.textAlign (Property)
JSSTag.textAlign (Property) The text alignment within the object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.textAlign
N
myJSSTag.textAlign = anAlignment
CSS syntax:
text-align: anAlignment
HTML syntax:
Argument list:
anAlignment
A text alignment control
The JSSTag.textAlign property corresponds to the text-align CSS property. This property controls the justification of text between the left and right margins. The following values are supported: ❑
left
❑
right
❑
center
❑
justify
IN addition a string can be used to indicate a character to use for decimal alignment. This need not be a dot but can be other characters to present a neatly laid out tabular column. The default value for this property depends on the user preference settings in the user agent. This value is inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
style.textAlign
1265
JavaScript Programmer's Reference
JSSTag.textDecoration (Property) The text decoration (underline, overline etc) for text in the object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.textDecoration
N
myJSSTag.textDecoration = aDecoration
CSS syntax:
text-decoration: aDecoration
Argument list:
aDecoration
A list of decorations for some text
The JSSTag.textDecoration property corresponds to the text-decoration CSS property. This controls the decoration of the text on screen with additional overprinting or dynamics. The following values are permitted: ❑
underline
❑
overline
❑
line-through
❑
blink
Beware when you use the underline attribute, people may think that it is a hyperlink. Also avoid using the blink decoration unless you really need to. It can become very annoying for the user unless it is used with taste and discretion. The default value for this property is "none". This value is not inherited from its parent container element although the attributes of the parent will persist.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
1266
style.textDecoration
J – JSSTag.textIndent (Property)
JSSTag.textIndent (Property) The indentation of text in the object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.textIndent
N
myJSSTag.textIndent = anIndent
CSS syntax:
text-indent: anIndent
Argument list:
anIndent
A value to indent the first line of text
The JSSTag.textIndent property corresponds to the text-indent CSS property. This value is used to indent the first line of text in the styled element. The value is numeric but can be specified in several ways: ❑
Absolute (10)
❑
Relative (-5)
❑
Percentage of paragraph width (10%)
The default value for this property is 0, meaning no indent at all. This value is inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
Measurement units, style.textIndent
JSSTag.textTransform (Property) The transformation of text in the object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
1267
JavaScript Programmer's Reference
JavaScript syntax:
N
myJSSTag.textTransform
N
myJSSTag.textTransform = aTransformation
CSS syntax:
text-transform: aTransformation
Argument list:
aTransformation
A character glyph transform
The JSSTag.textTransform property corresponds to the text-transform CSS property. This property provides a means to change the glyphs that are used without affecting the underlying source text. The following values are permitted: ❑
capitalize
❑
uppercase
❑
lowercase
❑
none
The default value is "none". This value is inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
style.textTransform
JSSTag.verticalAlign (Property) Control over the vertical alignment of the object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.verticalAlign
N
myJSSTag.verticalAlign = anAlignment
CSS syntax:
vertical-align: anAlignment
HTML syntax:
Argument list:
anAlignment
1268
A vertical alignment control
J – JSSTag.whiteSpace (Property)
The JSSTag.verticalAlign property corresponds to the vertical-align CSS property. This property controls the vertical alignment of an element. It provides a way to raise or lower individual letters to create subscript or superscript effects. The technique can be used to move images relative to a line of text. The following values are meaningful for this property: ❑
baseline
❑
sub
❑
super
❑
top
❑
text-top
❑
middle
❑
bottom
❑
text-bottom
In addition you can specify a percentage value and a length value in various units of measure. The default value for this property is "baseline". This value is not inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
style.verticalAlign
JSSTag.whiteSpace (Property) The control of white space collapsing or retention in the object. Availability:
Property/method value type: JavaScript syntax: CSS syntax: Argument list:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated String primitive N
myJSSTag.whiteSpace
myJSSTag.whiteSpace = aControl N white-space: aControl aControl
A whitespace preservation control
1269
JavaScript Programmer's Reference
The JSSTag.whiteSpace property corresponds to the white-space CSS property. This property controls how tabs, newline characters and additional whitespace inside an element is presented. The following values are available: ❑
normal
❑
pre
❑
nowrap
The default value for this property is "normal". This value is inherited from its parent container element.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
style.whiteSpace
JSSTag.width (Property) This is the width of an object. Availability:
CSS level – 1 JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
String primitive
JavaScript syntax:
N
myJSSTag.width
N
myJSSTag.width = aWidth
CSS syntax:
width: aWidth
HTML syntax:
Argument list:
aWidth
A CSS length value
The JSSTag.width property corresponds to the width CSS property. This property can be used to control the width of an object on the screen. The value can be specified as a length measured in units, a percentage of the containing block the element is located in or an "auto" value that lets the browser compute the size. The default value for this property is "auto". This value is not inherited from its parent container element.
1270
J – JSSTags object (Object/JSS)
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
JSSTag.height, style.width
JSSTags object (Object/JSS) Part of the Netscape Navigator style JSS rendering support. Availability: JavaScript syntax:
Argument list: Object properties:
JavaScript – 1.2 Netscape – 4.0 Deprecated myJSSTags = N myDocument.classes.aClassName myJSSTags = myDocument.ids.anIdValue N aClassName
The name of a style class
anIdValue
The value of an ID="..." HTML tag attribute
This object is somewhat like an array in that it contains a collection of objects that can be accessed associatively by name. However, unlike an array, it does not respond to the length property request. Also unlike an array, you cannot access its members using index values. The only meaningful property of this object is one of its array elements corresponding to an HTML tag name. There is one item in this collection for each HTML tag. This is part of the deprecated JSS support in Netscape 4.0. It is not recommended that you use these facilities in new projects. You cannot enumerate this object to inspect its properties. The document.tags object has properties that correspond to each of the stylable tags – for example, there is a document.tags.P, document.tags.B and document.tags.H1 object. Each of those objects has properties such as borderWidth and color so you can set or get the property value. Note that the tags object properties can be specified in mixed case as it is case-insensitive. Its properties contain objects that correspond to HTML tags and therefore they also have caseinsensitive properties that correspond to each tag's attributes. Its an interesting way to control style from JavaScript, but since it was only ever supported in Netscape 4.0 and is no longer available in Netscape 6.0 (which fully supports CSS), there is no future for JSS.
1271
JavaScript Programmer's Reference
Warnings: ❑
This is sometimes called tags object but if you inspect the object with some script that reveals its constructor, you will see it is really a member of the JSSTags class.
❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. Document.ids[], Document.tags[], JavaScript Style Sheets, JSSTag object, JSSTags.
See also:
Property
JavaScript
JScript
N
IE
1.2 +
-
4.0 +
-
Opera -
NES
ECMA DOM CSS
HTML
Notes
-
-
-
Warning, Deprecated
-
-
Property attributes: DontEnum.
JSSTags. (Property) A JSS object corresponding to a single HTML tag. Availability:
JavaScript – 1.2 Netscape – 4.0 Deprecated
Property/method value type:
JSSTag object
JavaScript syntax:
N
myDocument.classes.aClassName.aTagName
aClassName
The name of a style class
aTagName
The name of an HTML tag
Argument list:
This object represents an HTML tag. However it is only available in Netscape 4.0 and is a means of access that ultimately leads to a Style object. You can refer to a specific HTML tag name or you can use the value "all" to indicate that all HTML tags of any kind with the appropriate CLASS name will be affected. This mechanism is radically different to and much more complex than the simple style property belonging to an Element object in MSIE. From the value in this property, you would traverse the style tree down another level to find a style object with properties that directly affect the appearance of the document.
Warnings: ❑
Deprecated for any further use. This was available only in Netscape 4.0 and is completely removed from Netscape 6.0. See also:
1272
JSSTags object
J – Jump statement (Definition)
Jump statement (Definition) Unconditionally jump to a new location in the script. A jump statement is one, which forces the flow of execution to jump unconditionally to another location in the script. Jump statements in JavaScript are used to terminate iteration statements. A function call causes execution to go unconditionally to a new location (the beginning of the function's script source text block – its body) but a function call is not strictly a jump statement because the flow of control returns eventually to the line following the function call. A return statement is considered to be a jump statement. See also:
break, continue, goto, return, Statement
1273
K KBD object (Object/HTML) An object representing content to be displayed as if typed on the keyboard. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Inherits from:
Element object
JavaScript syntax:
IE
myKBD = myDocument.all.anElementID
IE
myKBD = myDocument.all.tags("KBD")[anIndex]
IE
myKBD = myDocument.all[aName]
-
myKBD = myDocument.getElementById(anElementID)
-
myKBD = myDocument.getElementsByName(aName)[anIndex] myKBD = myDocument.getElementsByTagName("KBD")[anIndex]
HTML syntax: Argument list:
Event handlers:
... anElementID
The ID attribute of the element required
anIndex
A reference to an element in a collection
aName
An associative array reference
onClick, onDblClick, onDragStart, onFilterChange, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onSelectStart
The appearance of the content described by this object is likely to look similar to that enclosed in , or tags. See also:
Element object, LISTING object, PRE object
Error! No text of specified style in document.
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick onDblClick onDragStart onFilterChange onHelp onKeyDown onKeyPress onKeyUp onMouseDown onMouseMove onMouseOut onMouseOver onMouseUp onSelectStart
1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + 1.5 + -
1.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 1.0 + 3.0 + 3.0 +
6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + -
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 +
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + -
-
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + -
Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning -
Inheritance chain: Element object, Node object
Keyboard events (Definition) Some events within the event-handling complex of a browser are related to keyboard handling. The following events relate to keyboard handling: ❑
onKeyDown
❑
onKeyUp
❑
onKeyPress
These events are classified as keyboard events because they are generated as a result of user interactions with the keyboard. Note that the onKeyPress event is triggered as a result of a matching pair of onKeyDown and onKeyUp events. You should not rely on the events arriving in any particular order, although onKeyPress probably arrives before onKeyUp. For example, as a key is pressed, an onKeyDown event is fired. As it is released, an onKeyUp event and an onKeyPress event are fired. An onKeyPress is only fired once for each onKeyDown and onKeyUp pair. In Netscape, you can capture keyboard events by calling the captureEvents() method like this: window.captureEvents(Event.KEYPRESS);
This need not necessarily apply to the window; the area of interest can be more limited by selecting an appropriate object.
1275
Chapter number
Example code: Send Mail Send Mail Send Mail
See also:
javascript: URL, mailbox: URL, nethelp: URL, UniversalSendMail, URL
main() function (Definition) The main entry point to a procedural language program. Property/method value type:
Implementation defined
Although JavaScript in many circumstances does not have a main() function, in some applications of the language it may be necessary. By implication, the main() function of a JavaScript is the global code that is present in a web page in the <SCRIPT> tags, but is not part of a function declaration body. When embedded in a browser, the language is invoked according to an event model and the browser itself is the main() for the interpreter. Various script based functions are called by the browser.
1379
JavaScript Programmer's Reference
In a server-side environment, a script may be used as the result of a CGI call. In that case, a main() with passed parameters is a more useful facility. In some implementations, the main() function may be used to make the language accessible to C programmers. Languages often borrow from one another and JavaScript borrows heavily from C language and Java. The exact form of the main() function and possibly its name will be implementation dependent and you should check the documentation for the interpreter just make sure it behaves the way you expect. The result of calling the main() function will be implementation specific, but probably an integer. See also:
argc parameter, argv parameter, Execution context, Execution environment, Host environment, Host object
MakeDate() (Time calculation) A date and time algorithm. Availability:
ECMAScript edition – 2
Property/method value type:
Number primitive
The MakeDate() operator calculates a number of milliseconds from its two arguments. Both arguments must be ECMAScript number values. All of the arguments must be numeric and finite values. The values should be integers. If they are not then the result will be NaN. The day argument is multiplied by the milliseconds per day and the time argument is added to the result. The sum of the two is a millisecond coded date and time value. Although this is called an operator in the standard, its behavior is more like that of a function. It is not part of the formal language implementation but is a useful function to have available, and can be simulated by writing a script-based function. It is documented in the standard to assist in the algorithmic breakdown of the Date method handlers. The result is a date value in milliseconds since the base date. See also:
Cast operator, Date object, Date(), Date.UTC(), Time range, Time value
Cross-references: ECMA 262 edition 2 – section – 15.9.1.13 ECMA 262 edition 3 – section – 15.9.1.13
1380
M – MakeDay() (Time calculation)
MakeDay() (Time calculation) A date and time algorithm. Availability:
ECMAScript edition – 2
Property/method value type:
Number primitive
The MakeDay() operator calculates a number of days from its three arguments. Each argument must be an ECMAScript number value. All of the arguments must be numeric and finite values. The values should be integers. If they are not then the result will be NaN. The month number is used as a lookup to establish the number of days in the preceding months. This will also take the year number into account because a leap year calculation may be necessary. The standard does not mandate any range checking, however it would be sensible to include range checks in the implementation of this functionality. Although this is called an operator in the standard, its behavior is more like that of a function. It is not part of the formal language implementation, but is a useful function to have available and can be simulated by writing a script-based function. It is documented in the standard to assist in the algorithmic breakdown of the Date method handlers. The result is a day value in milliseconds since the base date. See also:
Cast operator, Date object, Date(), Date.UTC(), Time range, Time value
Cross-references: ECMA 262 edition 2 – section – 15.9.1.12 ECMA 262 edition 3 – section – 15.9.1.12
MakeTime() (Time calculation) A date and time algorithm. Availability:
ECMAScript edition – 2
Property/method value type:
Number primitive
The MakeTime() operator calculates a number of milliseconds from its four arguments. Each argument must be an ECMAScript number value. All of the arguments must be numeric and finite values. The values should be integers. If they are not then the result will be NaN.
1381
JavaScript Programmer's Reference
The constant time values giving milliseconds per hour, minute and second are used to multiply each argument. The results are then summed to provide an equivalent time in milliseconds. No range checking is performed according to the ECMA standard so some degree of overflow can be expected. Although this is called an operator in the standard, its behavior is more like that of a function. It is not part of the formal language implementation, but is a useful function to have available and can be simulated by writing a script-based function. It is documented in the standard to assist in the algorithmic breakdown of the Date method handlers. The result is a time value since midnight measured in milliseconds. See also:
Cast operator, Date object, Date(), Date.UTC(), Time range, Time value
Cross-references: ECMA 262 edition 2 – section – 15.9.1.11 ECMA 262 edition 3 – section – 15.9.1.11
<MAP TARGET="..."> (HTML Tag Attribute) The frame or window to target by default with the links in an image map. This is a non-standard tag attribute that is used as a means of linking frames and area maps. You should use instead of <MAP TARGET="..."> for portable applications.
Warnings: ❑
Because this is a non-standard HTML tag attribute, most implementations will not support the TARGET attribute on a <MAP> tag. In that case, apply the TARGET attribute to the tags in the map instead. See also:
Anchor.target, Form.target, Map.target, Window.frames[]
Deprecated usage: Yes
1382
M – Map object (Object/HTML)
Map object (Object/HTML) An object that represents a <MAP> tag. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Inherits from:
Element object
JavaScript syntax:
IE
myMap = myDocument.all.anElementID
IE
myMap = myDocument.all.tags("MAP")[anIndex]
IE
myMap = myDocument.all[aName]
-
myMap = myDocument.getElementById(anElementID)
-
myMap = myDocument.getElementsByName(aName) [anIndex] myMap = myDocument.getElementsByTagName ("MAP")[anIndex]
HTML syntax: Argument list:
<MAP> ... anIndex
A reference to an element in a collection
aName
An associative array reference
anElementID
The ID value of an Element object
Object properties:
name, target
Event handlers:
onClick, onDblClick, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp
Collections:
areas[]
The <MAP> tag in the HTML document source is a container for the tags. These all belong to a parent Map object. This is a means of componentizing a client-side image map and building complex non-rectangular shaped areas. A object, Area object, Element object, Location object
See also:
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
name
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
-
target
1.5 +
3.0 +
6.0 +
4.0 +
-
-
-
-
1383
JavaScript Programmer's Reference
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onDblClick
1.5+
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onHelp
-
3.0 +
-
4.0 +
-
-
-
Warning
onKeyDown
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onKeyPress
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onKeyUp
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseDown
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseMove
1.5 +
3.0 +
6.0 +
4.0 +
-
-
4.0 +
Warning
onMouseOut
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseOver
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseUp
1.5 +
3.0 +
6.0 +
4.0 +
3.0 +
-
4.0 +
Warning
Inheritance chain: Element object, Node object
Map.areas[] (Collection) A collection of Area objects belonging to the map object. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
Collection object
JavaScript syntax:
-
myMap.areas
The objects instantiated by tags which are part of this image map, are collected together and accessible as a collection. The collection object is referred to by this property.
Property attributes: ReadOnly
1384
M – Map.name (Property)
Map.name (Property) The value of the NAME="..." HTML tag attribute. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myMap.name
Objects are identified either by the NAME="..." HTML tag attribute or by the ID="..." HTML tag attribute. Netscape Navigator shows a marginal preference for the name property while MSIE seems slightly better disposed towards the ID property. However, in many cases both browsers support either technique and in some cases will locate items named with either tag as if they existed in a single namespace. See also:
IMG.useMap
Map.target (Property) The target window or frame to which a map applied. Availability:
JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
HTML syntax:
<MAP TARGET="...">
myMap.target
This yields the value of the TARGET attribute in an , or <MAP> tag. You can assign a new value to this property so that the URL will be directed to a different window or frame.
1385
JavaScript Programmer's Reference
Here are some example target values: ❑
_parent
❑
_self
❑
_top
❑
_blank
❑
Window name
❑
Frame name See also:
<MAP TARGET="...">, Anchor.target, BASE.target, Form.target, Url.target
MARQUEE object (Object/HTML) An object that represents a <MARQUEE> HTML tag. Availability:
JScript – 3.0 Internet Explorer – 4.0
Inherits from:
Element object
JavaScript syntax:
IE
myMARQUEE = myDocument.all.anElementID
IE
myMARQUEE = myDocument.all.tags("MARQUEE") [anIndex] myMARQUEE = myDocument.all[aName]
IE HTML syntax: Argument list:
myMARQUEE = myDocument.getElementById(anElementID) myMARQUEE = myDocument.getElementsByName(aName) [anIndex] myMARQUEE = myDocument.getElementsByTagName ("MARQUEE")[anIndex]
<MARQUEE> anIndex
A reference to an element in a collection
aName
An associative array reference
anElementID Object properties:
The ID value of an Element object accessKey, behavior, bgColor, dataFld, dataFormatAs, dataSrc, direction, height, hspace, loop, scrollAmount, scrollDelay, tabIndex, trueSpeed, vspace, width
Object methods:
start(), stop()
Event handlers:
1386
onAfterUpdate, onBlur, onBounce, onClick, onDblClick, onDragStart, onFilterChange, onFinish, onFocus, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onResize, onRowEnter, onRowExit, onScroll, onSelectStart, onStart
M – MARQUEE object (Object/HTML)
The MARQUEE object is only supported by MSIE and provides means of quickly and easily generating a moving ticker display inside the window area. This can be accomplished with Netscape using layers and some interval timed JavaScript function calls to scroll the layer. The MSIE MARQUEE object is a little more aware of Font Metrics than your average script access can achieve. This means making the MARQUEE bounce back and forth when the text hits the edge of the extent rectangle is a lot easier to accomplish in MSIE than in Netscape. See also:
Element object, Input.accessKey
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
accessKey
-
3.0 +
-
4.0 +
-
-
-
-
behaviour
-
3.0 +
-
4.0 +
-
-
-
-
bgColor
-
3.0 +
-
4.0 +
-
-
-
-
dataFld
-
3.0 +
-
4.0 +
-
-
-
-
dataFormatAs
-
3.0 +
-
4.0 +
-
-
-
-
dataSrc
-
3.0 +
-
4.0 +
-
-
-
-
direction
-
3.0 +
-
4.0 +
-
-
-
-
height
-
3.0 +
-
4.0 +
-
-
-
-
hspace
-
3.0 +
-
4.0 +
-
-
-
-
loop
-
3.0 +
-
4.0 +
-
-
-
-
scrollAmount
-
3.0 +
-
4.0 +
-
-
-
-
scrollDelay
-
3.0 +
-
4.0 +
-
-
-
-
tabIndex
-
3.0 +
-
4.0 +
-
-
-
-
trueSpeed
-
3.0 +
-
4.0 +
-
-
-
-
vspace
-
3.0 +
-
4.0 +
-
-
-
-
width
-
3.0 +
-
4.0 +
-
-
-
-
Method
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
start()
-
3.0 +
-
4.0 +
-
-
-
-
stop()
-
3.0 +
-
4.0 +
-
-
-
-
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onAfterUpdate
-
3.0 +
-
4.0 +
-
-
-
-
onBlur
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
-
Warning
onBounce
-
3.0 +
-
4.0 +
-
-
-
-
onClick
1.0 +
3.0 +
4.0 +
3.0 +
3.0 +
-
4.0 +
Warning
onDblClick
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onDragStart
-
3.0 +
-
4.0 +
-
-
-
-
Table continued on following page
1387
JavaScript Programmer's Reference
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onFilterChange
-
3.0 +
-
4.0 +
-
-
-
-
onFinish
-
3.0 +
-
4.0 +
-
-
-
-
onFocus
1.0 +
3.0 +
2.0 +
4.0 +
3.0 +
-
-
Warning
onHelp
-
3.0 +
-
4.0 +
-
-
-
Warning
onKeyDown
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onKeyPress
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onKeyUp
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseDown
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseMove
1.2 +
3.0 +
4.0 +
4.0 +
-
-
4.0 +
Warning
onMouseOut
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onMouseOver
1.0 +
3.0 +
4.0 +
3.0 +
3.0 +
-
4.0 +
Warning
onMouseUp
1.2 +
3.0 +
4.0 +
4.0 +
3.0 +
-
4.0 +
Warning
onResize
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
onRowEnter
-
3.0 +
-
4.0 +
-
-
-
-
onRowExit
-
3.0 +
-
4.0 +
-
-
-
-
onScroll
-
3.0 +
-
4.0 +
-
-
-
-
onSelectStart
-
3.0 +
-
4.0 +
-
-
-
-
onStart
-
3.0 +
-
4.0 +
-
-
-
-
Inheritance chain: Element object, Node object
MARQUEE.behaviour (Property) A attribute that controls the motion of the text in the MARQUEE object. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myMARQUEE.behavior
The animated effect in the MARQUEE is controlled by this property. The following values are appropriate: ❑
alternate
❑
scroll
❑
slide
The alternate behavior marches left and then on bouncing into a boundary, marches right until it bounces again.
1388
M – MARQUEE.bgColor (Property)
The scroll and slide behaviors use the direction attribute to control the direction of movement. When set to scroll, the MARQUEE starts empty, the text scrolls in, traverses the MARQUEE and scrolls out again. A complete cycle begins and ends with an empty MARQUEE. When set to slide, the MARQUEE again starts empty, the text scrolls in until it hits a boundary. Then it is simply zapped out and does not scroll away. Again, a complete cycle begins and ends with an empty MARQUEE.
MARQUEE.bgColor (Property) The background color for the area occupied by the MARQUEE object. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myMARQUEE.bgColor
The background can be colored independently of whether an image is loaded into the background of an object. In fact, it may be advisable to set the background color to something similar to the average color of the background image in case the image takes a long time to load or the browser is unable to display a background image. See also:
color names, color value
MARQUEE.direction (Property) The direction of movement of the scrolling text in the MARQUEE. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myMARQUEE.direction
A MARQUEE object can scroll in all four cardinal directions. Leftward scrolling is most likely the appropriate setting for textual content written in a Roman script that is read from left to right. Diagonal scrolling is not possible with a MARQUEE but could be implemented using layers in Netscape 4 or an IFRAME in MSIE and Netscape 6.0. The following values are appropriate for this property: ❑
left
❑
right
❑
down
❑
up
1389
JavaScript Programmer's Reference
MARQUEE.height (Property) The height of the area allocated to the MARQUEE object as it appears onscreen. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myMARQUEE.height
The MARQUEE space is defined by an extent rectangle that surrounds the space occupied by it on the screen. An extent rectangle is that smallest rectangle that completely encloses the item. This property specifies the height of that extent rectangle.
MARQUEE.hspace (Property) The height of the area allocated to the MARQUEE object as it appears onscreen. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myMARQUEE.hspace
Margins placed around objects are either modified separately with all four margin sides having a different property or by adjusting the horizontal margins and vertical margins using just two values. The hspace property controls the margin to the left and right of the object.
MARQUEE.loop (Property) A count of the number of times the MARQUEE text is to scroll. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myMARQUEE.loop
You can define the number of cycles the MARQUEE animation will cycle round before stopping. When it stops, the text will remain visible. Continuous looping is specified by setting this property to a value of -1.
1390
M – MARQUEE.scrollAmount (Property)
MARQUEE.scrollAmount (Property) The offset of the text between one scroll cycle and the next. Availability: Property/method value type: JavaScript syntax:
JScript – 3.0 Internet Explorer – 4.0 Number primitive IE
myMARQUEE.scrollAmount
This value is specified in pixels, and controls the distance that the text appears to move on each scroll cycle of the MARQUEE. The larger the number, the faster the scrolling appears to travel.
MARQUEE.scrollDelay (Property) The time-delay in milliseconds between each scroll update. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myMARQUEE.scrollDelay
A short delay and small scroll distance will consume more CPU time but appear to be a smoother scroll.
MARQUEE.start() (Method) A command method to start the MARQUEE scrolling. Availability:
JScript – 3.0 Internet Explorer – 4.0
JavaScript syntax:
IE
myMARQUEE.start()
You can stop and start the MARQUEE animation whenever you want. Maybe it is appropriate to scroll a MARQUEE when a mouse is positioned over an object. You can call this method as part of a MouseOver event handler. Then, you can call its complementary MARQUEE.stop() method on the MoveMouseOut event handler.
MARQUEE.stop() (Method) A command method to stop the MARQUEE from scrolling. Availability:
JScript – 3.0 Internet Explorer – 4.0
JavaScript syntax:
IE
myMARQUEE.stop()
Refer to: MARQUEE.start()
1391
JavaScript Programmer's Reference
MARQUEE.trueSpeed (Property) A switch attribute that controls whether the browser should honor very small scroll delay times. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myMARQUEE.trueSpeed
Extremely small delay times may cause the MARQUEE to scroll more than once during each screen retrace interval. It is wasteful of the CPU resources to scroll the MARQUEE faster than the viewer can perceive the changes. A longer delay and greater scroll distance is more efficient although it may appear jerky for extreme settings.
MARQUEE.vspace (Property) The size of a vertical margin above and below the MARQUEE with respect to any adjacent objects. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myMARQUEE.vspace
Margins placed around objects are either modified separately with all four margin sides having a different property or by adjusting the horizontal margins and vertical margins using just two values. The vspace property controls the margin at the top and bottom of the object.
MARQUEE.width (Property) The width of the area allocated to the MARQUEE object as it appears onscreen. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myMARQUEE.width
The MARQUEE space is defined by an extent rectangle that surrounds the space occupied by it on the screen. An extent rectangle is that smallest rectangle that completely encloses the item. This property specifies the width of that extent rectangle.
1392
M – Mask() (Filter/visual)
Mask() (Filter/visual) A visual filter for creating a transparent mask. Availability:
JScript – 3.0 Internet Explorer – 4.0
Refer to: Filter – Mask()
MaskFilter() (Filter/visual) Uses the transparent color pixels of an object as a mask. Availability:
JScript – 5.5 Internet Explorer – 5.5
Refer to: Filter – MaskFilter()
Math object (Object/core) A globally available object containing a library of mathematical functions. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server version – 2.0 Opera – 3.0
JavaScript syntax:
-
Object properties:
constructor
Class constants:
E, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2
Functions:
abs(), acos(), asin(), atan(), atan2(), ceil(), cos(), exp(), floor(), log(), max(), min(), pow(), random(), round(), sin(), sqrt(), tan()
Math
The Math object is merely a single object owned by the Global Object and which cannot be instantiated. It has some named properties, some of which are functions while others are constants. The prototype for the Math prototype object is the Object prototype object.
1393
JavaScript Programmer's Reference
Although it cannot be instantiated, it does have a constructor which in turn has a prototype property. By adding functions to that prototype, you can extend the capabilities of the Math object. Several examples are provided in nearby topics to illustrate the addition of extra trigonometric and hyperbolic functions.
Warnings: ❑
The Math object provides a collection of static constant values by way of properties belonging to the integral Math object. Because the mathematical mechanisms of any application tend to be provided by the operating system, you should find that between different browsers on any particular platform, the values that these constants yield will be very consistent.
❑
The ECMA standard lays down strict values for these properties and in general, the browser manufacturers try to comply – however, there is always the possibility that an implementation may use a non-compliant calculation.
❑
However, it may not be quite so reliable across platforms. You might enumerate one of these constants as you are authoring and then hard code that value into your script. When that script is executed on another platform, even in the same browser, the internal mathematics support may yield a different value.
❑
You should always refer to the static constants using their symbolic names rather than hard code a possibly platform-dependent value into your script.
❑
Note for the trigonometric functions in general that certain implied identities cannot be assumed in JavaScript. For example: ❑
Math.sin(Math.PI/2) may not yield exactly 1
❑
Math.cos(Math.PI) may not return precisely zero
❑
Math.acos(0) may not return the same value as Math.PI
❑
Math.SQRT1_2 may not be exactly equal to the reciprocal of Math.SQRT2
See also:
Constant, Exponent-log function, Global object, Integer arithmetic, Java to JavaScript values, Native object, Object constant, Object object, Range error, Trigonometric function, Type conversion, unwatch(), watch()
Property
JavaScript
JScript
N
IE
Opera
NES
ECMA Notes
constructor
1.0 +
1.0 +
2.0 +
3.02 +
-
-
-
Cross-references: ECMA 262 edition 2 – section – 10.1.5 ECMA 262 edition 2 – section – 15.1.4.1 ECMA 262 edition 2 – section – 15.8 ECMA 262 edition 3 – section – 10.1.5 ECMA 262 edition 3 – section – 15.1.5.1 ECMA 262 edition 3 – section – 15.8
1394
-
M – Math.abs() (Function)
Math.abs() (Function) The absolute value of a positive or negative number. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.abs(aValue)
Argument list:
aValue
Some meaningful numeric value
This function returns the absolute value of the argument. The absolute value of a number is its distance from zero. In general, the result has the same magnitude as the argument but always has a positive sign. Special boundary conditions that affect the results are: Argument
Result
0
0
NaN
NaN
negative infinity
positive infinity
On some implementations, the absolute value of the most negative integer number may not be representable in the positive range. This is not the same as Number.MIN_VALUE and Number.MAX_VALUE. They describe the largest and smallest possible positive floating point values.
Warnings: ❑
It is possible that due to the underlying implementation of the math library, the absolute value of the most negative number may not be representable and it may yield NaN instead.
Example code: <SCRIPT> for(myEnum = 1.5; myEnum > -2; myEnum -= 0.1)
1395
JavaScript Programmer's Reference
{ document.write(myEnum + " " + Math.abs(myEnum) + "
"); }
See also:
Integer arithmetic, Integer-value-remainder, Math object, Math.ceil(), Math.floor(), Type conversion
Cross-references: ECMA 262 edition 2 – section – 15.8.2.1 ECMA 262 edition 3 – section – 15.8.2.1
Math.acos() (Function) The inverse cosine of the passed-in value. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.acos(aValue)
Argument list:
aValue
Some meaningful numeric value
This function returns the arc-cosine of the argument. Special boundary conditions that affect the results are: Argument
Result
1
0
greater than 1
NaN
less than -1
NaN
NaN
NaN
The exact value yielded by this function may vary slightly from implementation to implementation due to differences in the underlying precision of the implementations, math routines, and the specific algorithm selected to evaluate this function. The result of this method is the arc-cosine of the passed-in value. The result is expressed in radians and ranges from 0 to pi.
1396
M – Math.asin() (Function)
Warnings: ❑
Note that Math.acos(0) may not return the same value as Math.PI. See also:
Math object, Math.asin(), Math.atan(), Math.atan2(), Math.cos(), Math.PI, Math.sin(), Math.tan(), Trigonometric function
Cross-references: ECMA 262 edition 2 – section – 15.8.2.2 ECMA 262 edition 3 – section – 15.8.2.2
Math.asin() (Function) The inverse sine of the passed-in value. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server version – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.asin(aValue)
Argument list:
aValue
Some meaningful numeric value
This function returns the arc-sine of the argument. Special boundary conditions that affect the results are: Argument
Result
0 greater than 1 less than -1 NaN
0 NaN NaN NaN
The exact value yielded by this function may vary slightly from implementation to implementation due to differences in the underlying precision of the implementations, math routines, and the specific algorithm selected to evaluate this function. The result of this method is the arc-sine of the passed-in value. The result is expressed in radians and ranges from -pi/2 to +pi/2. See also:
Math object, Math.acos(), Math.atan(), Math.atan2(), Math.cos(), Math.sin(), Math.tan(), Trigonometric function
1397
JavaScript Programmer's Reference
Cross-references: ECMA 262 edition 2 – section – 15.8.2.3 ECMA 262 edition 3 – section – 15.8.2.3
Math.atan() (Function) The inverse tangent of the passed-in value. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.atan(aValue)
Argument list:
aValue
Some meaningful numeric value
This function returns the arc-tangent of the argument. Special boundary conditions that affect the results are: Argument
Result
0
0
minus infinity
-pi/2
NaN
NaN
plus infinity
+pi/2
The exact value yielded by this function may vary slightly from implementation to implementation due to differences in the underlying precision of the implementations, math routines, and the specific algorithm selected to evaluate this function. The result of this method is the arc-tangent of the passed-in value. The result is expressed in radians and ranges from -pi/2 to +pi/2. See also:
Math object, Math.acos(), Math.asin(), Math.atan2(), Math.cos(), Math.sin(), Math.tan(), Trigonometric function
Cross-references: ECMA 262 edition 2 – section – 15.8.2.4 ECMA 262 edition 3 – section – 15.8.2.4
1398
M – Math.atan2() (Function)
Math.atan2() (Function) The inverse tangent of the slope of the two arguments. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 3.0 Internet Explorer – 4.0 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.atan2(aValue1, aValue2)
Argument list:
aValue1 aValue2
Some meaningful numeric value Some meaningful numeric value
This function computes the quotient of arg2/arg1 and then returns the arc-tangent of the result. It takes into account which quadrant the value falls into according to the signs of the two arguments. It is provided in several languages other than JavaScript for those situations where very large numbers are involved. Traditionally, for this function, the Y argument is placed first and the X argument second. Special boundary conditions that affect the results are: Argument1
Argument2
Result
+infinity
+infinity
+pi/4
+infinity
-infinity
+3pi/4
+infinity
non zero
+pi/2
-infinity
+infinity
-pi/4
-infinity
-infinity
-3pi/4
-infinity
non zero
-pi/2
0
negative
pi * sign of Argument1
0
positive
0
0
0
+pi/2
Any value
NaN
NaN
NaN
Any value
NaN
non zero
+infinity
0
1399
JavaScript Programmer's Reference
The exact value yielded by this function may vary slightly from implementation to implementation due to differences in the underlying precision of the implementations, math routines, and the specific algorithm selected to evaluate this function. The result of this method is the arc-tangent of the slope of the two arguments. The result is expressed in radians and ranges from -pi to +pi. See also:
Math object, Math.acos(), Math.asin(), Math.atan(), Math.cos(), Math.sin(), Math.tan(), Trigonometric function
Cross-references: ECMA 262 edition 2 – section – 15.8.2.5 ECMA 262 edition 3 – section – 15.8.2.5
Math.ceil() (Function) The value rounded up to the next higher integer value. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.ceil(aValue)
Argument list:
aValue
A meaningful numeric value
According to the ECMA standard, this function returns the smallest number value that is not less than the argument and is equal to a mathematical integer. If the argument is already an integer, the argument itself is returned. Special boundary conditions that affect the results are: Argument
Result
+infinity
+infinity
-1 < argument > 0
0
-infinity
-infinity
0
0
NaN
NaN
1400
M – Math.constructor (Property)
Note that if the value is negative, the magnitude decreases while it increases for positive numbers. The ceil of 25.4 is 26 whereas the ceil of -25.4 is -25. The result is the input value rounded up to the next higher integer value.
Warnings: ❑
Other reference sources on this function differ as to its functionality. Some indicate that it rounds up to an integer, others that it rounds down. This suggests that some implementations may behave differently since they may use the available documentation to design their interpreter. The ECMA standard is probably the most reliable specification long term since manufacturers will attempt to build ECMA compliance into their implementations as a selling point.
❑
Recent browsers from Microsoft, Netscape and Opera are all compliant with the ECMA standard on this point.
❑
If you are uncertain, you should check the functionality by running some tests. For example, run the test for negative and positive values. Checking a few boundary conditions won't hurt either. See also:
Integer, Integer arithmetic, Integer-value-remainder, Math object, Math.abs(), Math.floor(), Math.round(), Number(), Remainder (%), Remainder then assign (%=), Type conversion
Cross-references: ECMA 262 edition 2 – section – 15.8.2.6 ECMA 262 edition 3 – section – 15.8.2.6
Math.constructor (Property) A means of creating a new Math object. Availability:
JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0
Property/method value type:
Math object
JavaScript syntax:
-
Math.constructor
Both Netscape and MSIE support a constructor property for the Math object. It is unlikely you would ever want to construct a copy of the Math object. However, this is useful not for the purpose of cloning the Math object but so that you can extend it by adding your own properties and methods to its prototype. This technique is demonstrated in the example which appears to add a pythag() function to the Math object although it is really added to the Object() object prototype.
1401
JavaScript Programmer's Reference
Example code: <SCRIPT> // Define a function that extends the capabilities of the Math object function pythag(aValue1, aValue2) { return Math.sqrt((aValue1*aValue1) + (aValue2*aValue2)); } // Register the new function Math.constructor.prototype.pythag = pythag; // Test the Math.pythag() method document.write(Math.pythag(3, 4)) document.write("
")
Math.cos() (Function) The cosine of the input argument. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server version – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.cos(aValue)
Argument list:
aValue
An angle measured in radians
This function returns the cosine of the argument. The argument must be expressed in radians. Special boundary conditions that affect the results are: Argument
Result
+infinity
NaN
-infinity
NaN
0
1
NaN
NaN
The exact value yielded by this function may vary slightly from implementation to implementation due to differences in the underlying precision of the implementations math routines and the specific algorithm selected to evaluate this function.
1402
M – Math.cosec() (Simulated functionality)
Warnings: ❑
Note that Math.cos(Math.PI) may not return precisely zero. See also:
Math object, Math.acos(), Math.asin(), Math.atan(), Math.atan2(), Math.PI, Math.sin(), Math.tan(), Trigonometric function
Cross-references: ECMA 262 edition 2 – section – 15.8.2.7 ECMA 262 edition 3 – section – 15.8.2.7
Math.cosec() (Simulated functionality) The cosec() function is not available in JavaScript but can be simulated to aid in the porting of existing code. The example demonstrates how to add the cosec() method to the Math object.
Example code: <SCRIPT> // Add the cosec function to the Math object function cosec(aValue) { return 1/Math.sin(aValue); } // Register the new function Math.constructor.prototype.cosec = cosec; // Test the Math.cosec() method document.write(Math.cosec(2)); document.write("
")
See also:
Math.cot(), Math.sec()
1403
JavaScript Programmer's Reference
Math.cosh() (Simulated functionality) The cosh() function is not available in JavaScript but can be simulated to aid in the porting of existing code. The example demonstrates how to add the cosh() method to the Math object.
Example code: <SCRIPT> // Add the cosh function to the Math object function cosh(aValue) { var myTerm1 = Math.pow(Math.E, aValue); var myTerm2 = Math.pow(Math.E, -aValue); return (myTerm1+myTerm2)/2; } // Register the new function Math.constructor.prototype.cosh = cosh; // Test the Math.cosh() method document.write(Math.cosh(2)); document.write("
");
Math.cot() (Simulated functionality) The cot() function is not available in JavaScript but can be simulated to aid in the porting of existing code. The example demonstrates how to add the cot() method to the Math object to provide the capability to calculate cotangents.
Example code: <SCRIPT> // Add the cot function to the Math object function cot(aValue) { return 1/Math.tan(aValue); }
1404
M – Math.E (Constant/static)
// Register the new function Math.constructor.prototype.cot = cot; // Test the Math.cot() method document.write(Math.cot(2)); document.write("
");
See also:
Math.cosec(), Math.sec()
Math.E (Constant/static) A mathematical constant value. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape Navigator – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.E
The numeric constant value for e, the base of natural logarithms. The resulting value is approximately 2.718281828459045 (to 15 d.p.).
Warnings: ❑
The word approximately is used when describing the result, because the mathematical accuracy of JavaScript implementations leaves something to be desired and there are some strange artifacts in some of the calculations. See also:
Arithmetic constant, Exponent-log function, Floating point constant, Math object, Math.exp()
Property attributes: ReadOnly, DontDelete, DontEnum.
Cross-references: ECMA 262 edition 2 – section – 15.8.1.1 ECMA 262 edition 3 – section – 15.8.1.1
1405
JavaScript Programmer's Reference
Math.exp() (Function) The exponential function of the passed-in argument. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.exp(aValue)
Argument list:
aValue
A meaningful numeric value
This function returns the exponential function of the argument (e raised to the power of the argument, where e is the base of the natural logarithms). Special boundary conditions that affect the results are: Argument
Result
+infinity
+infinity
-infinity
0
0
1
NaN
NaN
The exact value yielded by this function may vary slightly from implementation to implementation, due to differences in the underlying precision of the implementations, math routines, and the specific algorithm selected to evaluate this function. See also:
Cross-references: ECMA 262 edition 2 – section – 15.8.2.8 ECMA 262 edition 3 – section – 15.8.2.8
1406
Exponent-log function, Math object, Math.E, Math.LN10, Math.LN2, Math.log(), Math.LOG10E, Math.LOG2E
M – Math.floor() (Function)
Math.floor() (Function) The value is rounded down to the next integer. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape Navigator – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.floor(aValue)
Argument list:
aValue
A meaningful numeric value
Returns the greatest number value that is not greater than the argument and is equal to a mathematical integer. If the argument is already an integer, the argument itself is returned. Special boundary conditions that affect the results are: Argument
Result
+infinity
+infinity
-infinity
-infinity
0
0
0 < argument > 1
0
NaN
NaN
Note that if the value is negative, the magnitude increases while it decreases for positive numbers. The floor of 25.4 is 25 whereas the floor of -25.4 is -26. The result is the input value rounded down to the next integer.
Warnings: ❑
Other reference sources on this function differ as to its functionality. Some indicate that it rounds up to an integer, others that it rounds down. However, all implementations appear to conform to the ECMA specified behavior. See also:
Integer, Integer arithmetic, Integer-value-remainder, Math object, Math.abs(), Math.ceil(), Math.round(), Number(), Remainder (%), Remainder then assign (%=), Type conversion
Cross-references: ECMA 262 edition 2 – section – 15.8.2.9 ECMA 262 edition 3 – section – 15.8.2.9
1407
JavaScript Programmer's Reference
Math.LN10 (Constant/static) A mathematical constant value. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server version – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.LN10
This constant provides the numeric value for the natural logarithm of 10. The resulting value value is approximately 2.302585092994046 (to 15 d.p.)
Warnings: ❑
The word approximately is used when describing the result, because the mathematical accuracy of JavaScript implementations leaves something to be desired and there are some strange artifacts in some of the calculations. See also:
Arithmetic constant, Exponent-log function, Floating point constant, Math object, Math.exp()
Property attributes: ReadOnly, DontDelete, DontEnum.
Cross-references: ECMA 262 edition 2 – section – 15.8.1.2 ECMA 262 edition 3 – section – 15.8.1.2
Math.LN2 (Constant/static) A mathematical constant value. Availability:
1408
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
M – Math.log() (Function)
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.LN2
This constant provides the numeric value of the natural logarithm of 2. The resulting value returned is approximately 0.693147180559945 (to 15 d.p.) See also:
Arithmetic constant, Exponent-log function, Floating point constant, Math object, Math.exp()
Property attributes: ReadOnly, DontDelete, DontEnum.
Cross-references: ECMA 262 edition 2 – section – 15.8.1.3 ECMA 262 edition 3 – section – 15.8.1.3
Math.log() (Function) The natural logarithm of the passed-in value. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.log(aValue)
Argument list:
aValue
A meaningful numeric value
This function returns the natural (base e) logarithm of the input argument. This function is the inverse of the Math.exp() function. Special boundary conditions that affect the results are: Argument
Result
+infinity 0 1 // Add the sec function to the Math object function sec(aValue) { return 1/Math.cos(aValue); } // Register the new function Math.constructor.prototype.sec = sec; // Test the Math.sec() method document.write(Math.sec(2)); document.write("
");
See also:
Math.cosec(), Math.cot()
Math.sin() (Function) The sine of the passed in value. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.sin(aValue)
Argument list:
aValue
An angle measured in radians
1418
M – Math.sinh() (Simulated functionality)
This function returns the sine of the input argument. The argument value must be expressed in radians. Special boundary conditions that affect the results are: Argument
Result
+infinity
NaN
-infinity
NaN
0
0
NaN
NaN
The exact value yielded by this function may vary slightly from implementation to implementation, due to differences in the underlying precision of the implementations, math routines, and the specific algorithm selected to evaluate this function.
Warnings: ❑
Note that Math.sin(Math.PI/2) may not yield exactly 1. See also:
Math object, Math.acos(), Math.asin(), Math.atan(), Math.atan2(), Math.cos(), Math.PI, Math.tan(), Trigonometric function
Cross-references: ECMA 262 edition 2 – section – 15.8.2.16 ECMA 262 edition 3 – section – 15.8.2.16
Math.sinh() (Simulated functionality) The sinh() function is not available in JavaScript but can be simulated to aid in the porting of existing code. The example demonstrates how to add the sinh() method to the Math object.
Example code: <SCRIPT> // Add the sinh function to the Math object function sinh(aValue) { var myTerm1 = Math.pow(Math.E, aValue); var myTerm2 = Math.pow(Math.E, -aValue); return (myTerm1-myTerm2)/2; }
1419
JavaScript Programmer's Reference
// Register the new function Math.constructor.prototype.sinh = sinh; // Test the Math.sinh() method document.write(Math.sinh(2)); document.write("
");
Math.sqrt() (Function) The square root of the input argument. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
Math.sqrt(aValue)
Argument list:
aValue
A meaningful numeric value
This function computes the square root of the input argument. Special boundary conditions that affect the results are: Argument
Result
+infinity
+infinity
0
0
tag to allow Java to access the JavaScript object space. This is an HTML tag attribute that can significantly affect the success or failure to run applets and plugins properly. The MAYSCRIPT attribute must be present in the <APPLET> tag if you have applets that expect to communicate with JavaScript. This is a way of allowing applets to script under the behest of the web page author who may not be the person who programmed the applet. This way, the author has to know and expect the applet to connect to JavaScript before the applet is able to do so. Without this attribute, an applet is not able to access the JSObject class and communicate with the JavaScript environment. The MAYSCRIPT HTML tag attribute is not reflected into the JavaScript environment. See also:
JavaScript embedded in Java, JSObject object
Measurement units (Definition) Style position and size properties use measurement units to locate objects on the screen. Measurement units specify the units of measure of a quantity. These are typically used for length measurement but may also be used for time measurement in aural style sheet properties. The units include the following: Unit
Description
# % cm deg em
A hash precedes hex color triplet values. A percentage of the containing element's value. Absolute measure of a centimeter. A value used for angular positioning of sound sources. A floating point value indicating a fractional portion of the length of an em-dash in the current font. A floating point value used to multiply the height of a small x in the current font. A frequency value for aural style sheets. Absolute measure of an inch. A frequency value for aural style sheets. Absolute measure of a millimeter. A value in milli-seconds (used for aural style durations). Absolute measure of a pica. Absolute measure of a pica (possibly a misprint in some documentation). Absolute measure using a font point size. An integer value measured in pixels on the screen. A value in seconds (used for aural style durations).
ex Hz in kHz mm ms pc pi pt px s
Measurement units referring to a spatial distance on the page are sometimes called Length units.
1425
JavaScript Programmer's Reference
MediaList object (Object/DOM) This object is added to DOM level 2 to support media lists in style sheets. Availability:
DOM level – 2 JavaScript – 1.5 Netscape – 6.0
JavaScript syntax:
N
myMedialist = new MediaList()
DOM level 2 specifies the following properties for this object: ❑
mediaText
❑
length
DOM level 2 specifies these methods: ❑
item()
❑
deleteMedium()
❑
appendMedium()
Member (Definition) Elements within an object. Members of structures and unions in other languages have some analogy with methods and properties of an object. In a procedural language you can access members of a structure by name. So also can you access properties within an object. A member name is an identifier. The notation for accessing structure members in C language and property values in JavaScript is identical: ❑
anObject.aProperty
❑
aCStruct.aMember
There is a variation in JavaScript that allows properties to be called as functions, thus: ❑
anObject.aFunctionProperty()
This notation can also denote methods that belong to an object. See also:
1426
Method, Namespace
M – Memory allocation (Definition)
Memory allocation (Definition) The process of locating and allocating some memory to store a string or object. See also:
Reference counting, Memory management
Memory leak (Definition) The consumption of memory that is not recoverable. When the reference count for an object is zero, the object can be garbage collected. Also, because there are no references to it, you have no handle by which you can reach it, so if it isn't garbage collected, it will waste the space it occupies. When that happens, you have a memory leak. Memory leaks typically happen in web-based JavaScript when you create and destroy a lot of strings in a loop. Concatenating many strings together and extending one string incrementally is a typical leak-producing technique. Garbage collection generally only happens in web browsers when the page is refreshed. See also:
delete, Garbage collection, Memory management, Object(), Option(), Reference counting, Variable, Window.setInterval(), Window.setTimeout()
Cross-references: Wrox Instant JavaScript – page – 29
Memory management (Definition) The process of organizing and keeping track of memory allocation and de-allocation. Memory management in compiled languages tends to be a primary concern of software developers. Because JavaScript is interpreted and is intended for use by designers as well as developers, a great deal of the complexity of memory management is hidden from view. It is still possible however to design a script that will consume large amounts of memory due to what is called a memory leak. A memory leak is when you allocate some storage and you don't subsequently relinquish it and make it available to the system again. A prime example of a memory leak in the context of a JavaScript execution is the allocation of string data to String variables. When a new assignment is made, the old storage is unlinked from the variable and some new storage is allocated. This means that the storage management is far simpler because the strings tend to grow longer as new values are assigned. However, in a web browser, the discarded string values continue to sit around in memory until the page is refreshed. At that stage, all page local values are purged and the memory is freed.
1427
JavaScript Programmer's Reference
You cannot force a garbage collection in a JavaScript execution session in a web browser other than by setting the location.href of the current page to itself. This has the side effect of reloading the page from the web server, presenting the user with a possibly ugly transition artifact and increasing net traffic. However, this may be far more preferable than consuming 50 Megabytes of memory every few minutes in the client. See also:
Garbage collection, Memory leak
MENU object (Object/HTML) An object that represents the contents of a <MENU> tag. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Inherits from:
Element object
JavaScript syntax:
IE
myMENU = myDocument.all.anElementID
IE
myMENU = myDocument.all.tags("MENU")[anIndex]
IE
myMENU = myDocument.all[aName]
-
myMENU = myDocument.getElementById(anElementID)
-
myMENU = myDocument.getElementsByName(aName)[anIndex] myMENU = myDocument.getElementsByTagName("MENU")[anIndex]
HTML syntax: Argument list:
Object properties: Event handlers:
<MENU> ... anIndex
A reference to an element in a collection
aName
An associative array reference
anElementID
The ID value of an Element object
compact onClick, onDblClick, onDragStart, onFilterChange, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onSelectStart
The DOM level 1 specification refers to this as a MenuElement object. See also:
Element object
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
compact
1.5 +
3.0 +
6.0 +
4.0 +
-
1+
-
-
1428
M – MENU.compact (Property)
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick onDblClick onDragStart onFilterChange onHelp onKeyDown onKeyPress onKeyUp onMouseDown onMouseMove onMouseOut onMouseOver onMouseUp onSelectStart
1.0 + 1.2 + 1.2 + 1.2 + 1.2 + 1.2 + 1.2 + 1.1 + 1.0 + 1.2 + -
1.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 1.0 + 3.0 + 3.0 +
6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + -
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 +
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + -
-
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + -
Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning -
Inheritance chain: Element object, Node object
MENU.compact (Property) An attribute that controls the display of <MENU> items and the amount of space they require on the screen. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
Boolean primitive
JavaScript syntax:
-
myMENU.compact
Refer to: DL.compact
menubar (Property) An alias for the window.menubar property. Availability:
JavaScript – 1.2 Netscape – 4.0
Property/method value type:
Bar object
1429
JavaScript Programmer's Reference
JavaScript syntax:
See also:
-
menubar
-
myWindow.menubar
Bar object, Window.menubar
Property attributes: ReadOnly.
<META> (HTML Tag) Document meta-information container. Availability:
JavaScript – 1.2 Netscape – 4.0
HTML syntax:
<META HTTP-EQUIV="aName" CONTENT="aValue">
Argument list:
aName
A pseudo header name
aValue
A pseudo header value
The <META> tag is a way of adding information about the document to the document. This information is never intended for display to the user but helps the browser and other server side systems (and proxies) to manage the document. There are many attributes to the <META> tag. We have only covered the ones that are helpful in the context of script development here. The items that are particularly useful to us are the HTTP_EQUIV and CONTENT attributes. These are used to add information to the HTTP response body. The browser can see these values in the <META> tag and interprets them as if they had been part of the HTTP header. So: <META HTTP-EQUIV="name" CONTENT="value"> is understood to be equivalent to an HTTP header like this: name: value As far as JavaScript is concerned, there are two <META> tags that are useful. This one defines the default scripting language: <META HTTP-EQUIV="Content-Script-Type" CONTENT="text/JavaScript">
1430
M – META object (Object/HTML)
If you have access to the server mechanism, you might be able to effect the same things by forcing it to add this header to the response as it goes out: Content-Script-Type: text/JavaScript The second useful <META> tag is used to define the default style definition language. Given all the warnings about JSS not being portable and it having been deprecated, you could use this in your document block: <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/JavaScript"> Again, if you have access to the server mechanism, you might be able to add this header to the response as it goes out: Content-Style-Type: text/JavaScript
Warnings: ❑
Since MSIE does not support JSS and Netscape ignores the tag variants, these <META> tags are of limited use. See also:
<SCRIPT LANGUAGE="...">, <SCRIPT>, <STYLE TYPE="...">, <STYLE>, JavaScript Style Sheets, META object
Cross-references: Wrox Instant JavaScript – page – 52
META object (Object/HTML) An object that represents the contents of a <META> tag. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Inherits from:
Element object
JavaScript syntax:
IE
myMETA = myDocument.all.anElementID
IE
myMETA = myDocument.all.tags("META")[anIndex]
IE
myMETA = myDocument.all[aName]
-
myMETA = myDocument.getElementById(anElementID)
-
myMETA = myDocument.getElementsByName(aName)[anIndex] myMETA = myDocument.getElementsByTagName("META")[anIndex]
HTML syntax:
<META>
1431
JavaScript Programmer's Reference
Argument list:
anIndex
A reference to an element in a collection
aName
An associative array reference
anElementID
The ID value of an Element object
Object properties:
charset, content, httpEquiv, name, scheme, url
Event handlers:
onClick, onDblClick, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp
These tags and their corresponding object instantiations are used to convey hidden information about the document. This information might be useful to a search engine for example. Sometimes the server uses the META information to control the way the pages are cached into a proxy. Likewise, a client browser may use these values to control the local caching and expiry times of a document. There may be several META objects associated with a document. There is no collection object that provides an enumerable set containing only the META objects but you can traverse the document.all[] collection and extract them in MSIE or use the collection returned by the DOM compliant document.getElementsByTagName("META") method which is supported on Netscape 6.0 and recent versions of MSIE. It is possible you might know the unique ID="..." HTML tag attribute value in which case you can access the required object directly. This is not currently supported at all in Netscape 4.0 although, because it is part of the DOM specification, it is added to Netscape 6.0.
Warnings: ❑ ❑
Netscape 6.0 returns an undefined value for the charset property and incorrectly appends it to the content property. For this meta tag: ❑
❑
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
Netscape Navigator 6.0 returns these values: ❑
myMeta.httpEquiv is defined as "Content-Type"
❑
myMeta.content is defined as "text/html; charset=8859-1"
❑
myMeta.charset is undefined
See also:
<META>, Element object, META.charset
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
charset content httpEquiv name scheme url
1.5 + 1.5 + 1.5 + 1.5 + -
3.0 + 3.0 + 3.0 + 3.0 + 5.0 + 3.0 +
6.0 + 6.0 + 6.0 + 6.0 + -
4.0 + 4.0 + 4.0 + 4.0 + 5.0 + 4.0 +
-
1+ 1+ 1+ 1+ -
-
-
1432
M – META.charset (Property)
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick onDblClick onHelp onKeyDown onKeyPress onKeyUp onMouseDown onMouseMove onMouseOut onMouseOver onMouseUp
1.0 + 1.2 + 1.2 + 1.2 + 1.2 + 1.2 + 1.2 + 1.1 + 1.0 + 1.2 +
1.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 1.0 + 3.0 +
6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 + 6.0 +
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 +
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 +
-
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 +
Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning
Inheritance chain: Element object, Node object
META.charset (Property) A value containing the character encoding of the content in the <META> tag. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myMETA.charset
This would contain the character set being used by the document referred to by the HREF="..." HTML tag attribute. For example the value "iso-8859-1" is likely to be returned but the local variant of the browser and OS may affect the value you get. This property might contain a value such as: csISO5427Cyrillic Details of other aliases can be located at the IANA registry. See also:
META object, META.content
Web-references: ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets
1433
JavaScript Programmer's Reference
META.content (Property) The contents of the VALUE="..." HTML tag attribute belonging to the <META> tag that the object represents. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myMETA.content
A <META> tag will contain a name-value pair stored in two separate HTML tag attributes. The content property relates to the value part of that name-value pair. The name property is contained in a NAME="..." HTML tag attribute. The web server hides additional information in header records that the client browser uses, but which are invisible to the user and generally hard to access from JavaScript. The <META> tags support an HTTP-EQUIV="..." HTML tag attribute which, although encoded as part of the document source, will behave as if it were a server response header value. This is also used in conjunction with the content property as an alternative way of forming a name-value pair. See also:
META.charset, META.httpEquiv
META.httpEquiv (Property) The contents of the HTTP-EQUIV="..." HTML tag attribute belonging to the <META> tag that the object represents. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myMETA.httpEquiv
This property will also reflect the value of the NAME-="..." HTML tag attribute if that was used in preference to the HTTP-EQUIV="..." HTML tag attribute. However only one or the other may be present in the <META> tag in the document source. This property is used in conjunction with the content property to construct a name-value pair. See also:
1434
META.content
M – META.name (Property)
META.name (Property) The name of the meta information this object describes. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 3.0 Internet Explorer – 4.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myMETA.name
This is the value of the NAME="..." HTML tag attribute in the <META> tag that instantiated this object.
META.scheme (Property) A describer for the content form. Availability:
DOM level – 1 JavaScript – 1.5 JScript – 5.0 Internet Explorer – 5.0 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myMETA.scheme
The meta data in the tags may use the same names in a name=value pair to mean something different according to who defined the meta tag contents. The scheme property reflects the SCHEME="..." HTML tag attribute and defines separate namespaces so the meta information can be interpreted more correctly. It offers a context within which the meta data values are defined.
META.url (Property) A special MSIE supported property containing the URL associated with a <META> tag. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myMETA.url
Occasionally, most likely in an auto-refresh META tag, you will need to specify a URL value. An autorefresh tag uses a client-pull technique to request a page update automatically after a timed interval.
1435
JavaScript Programmer's Reference
Metacharacter (Definition) A special symbolic way of describing some property of a character. Used in regular expressions.
Refer to: RegExp pattern
Method (Definition) A method is an action that can be performed on an object. Availability:
ECMAScript edition – 2
Functions are implemented in the script interpreter objects and are accessed as methods when they are themselves associated with an object. Methods are owned by objects. An instance of a class can own some private methods, which it does not share. It can also share methods it inherits from its prototype. Privately owned methods are sometimes called instance methods. Those functions that are associated with the Global object do not need an object prefix to be used. The Global object is always present and available and in the scope chain and prototype inheritance tree. Therefore the identifiers for those functions can be resolved easily, and in your script code they appear to be like functions in C language. When you declare functions in your script, as they are constructed they are associated with the Global object and are also available in the same way. Functions associated with the Math object require the Math object to be cited when they are called. Because they are visibly associated with the object and are called via the object, they are methods. You can specifically associate one of your own functions with an object other than the Global object. If you do that, then you can refer to the owner object with the variable named 'this'. It is a special variable that is like the 'self' variable in Smalltalk. Because a function is an object and associating it with your own object is by means of a reference to the function object, you can share function code between several objects. So, a method is simply a function that is written in a particular way that means it works well when associated with an object. As soon as you start to use the 'this' variable, then it's likely your function is no longer useful as a stand-alone function and ought to really be called as a method from that point onwards.
1436
M – Microsoft TV (TV Set-top Box)
Example code: // Function to print an owner object property function my_name() { document.write(this.name); } // Create a new object instance var myObject = new Object; // Define the name property for the object myObject.name = "Example"; // Associate the function so it can be used as a method, // note that we omit the parentheses myObject.my_name = my_name; // Call the function via the method interface myObject.my_name(); // Call the function normally my_name();
See also:
Accessor method, Function, function( ... ) ..., java.util, Member, Property, Statement, this
Cross-references: ECMA 262 edition 2 – section – 4.3.3 ECMA 262 edition 3 – section – 4.3.3 Wrox Instant JavaScript – page – 30
Microsoft TV (TV Set-top Box) A digital TV set-top box. This is a more enhanced version of the WebTV box. It may well work on analogue but is really intended for deployment in a digital TV environment. The triggering and standard HTML support is defined according to the ATVEF platform specifications, which are evolving and are not yet complete but are looking to be the definitive profile that 'Browser in a box' type of system needs to conform to. Technically, this platform is more advanced than WebTV but it is fundamentally the same. The JavaScript capabilities in this system would be broadly in line with what you would expect a normal PC browser to cope with but there may be a few limitations here and there. There are also likely to be extensions provided as new object types and possibly some additional methods added to existing objects but these would be quite minimal. Detecting that you are running in a set-top box may not always be easy. The user agent values may not tell you that you have a DTV environment available and you may need to be a little more clever and test for the existence of specific object classes. You need to do that in a way that does not cause a run-time error of course. It's a good technique to practice to ensure your scripts run reliably regardless of whether they are designed for use with Microsoft TV or not. See also:
ATVEF, WebTV
1437
JavaScript Programmer's Reference
MIME types (Definition) An Internet standard way of distinguishing between different kinds of container files. The MIME types mechanism was originally developed for sending attachments in mail messages. Nowadays it has become a commonplace way of describing the content of a document in a way that many non e-mail client applications can understand. This is defined as part of the HTML 4.0 standard. Here is a list of some relevant MIME types for JavaScript programmers: MIMEType
Description
*
Wildcard match everything
*/*
Wild card match both parts separately
application/applefile
AppleSingle file
application/AppleLink
AppleLink Package
application/ArcMac
PC ARChive
application/BBEdit
ML Source
application/binary
Application Binary Data
application/Canvas
Canvas Drawing
application/cdf
Channels
application/CodeWarrior
Java Class File
application/Compact_Pro
Compact Pro Archive
application/DeArj
ARJ Archive
application/DiskCopy
Apple DiskCopy Image
application/Envoy
Envoy Document
application/Excel
Lotus Spreadsheet r2.1
application/FileMaker_Pro
FileMaker Pro Database
application/FileMaker_Pro_3
FileMaker Pro Database
application/Finder
OpenType Font
application/FoxBase+
DBase Document
application/fractals
Fractal Image Format
application/futuresplash
FutureSplash Player
application/GraphicConverter
Animated NeoChrome
application/gzip
application/gzip
application/HexEdit
Untyped Binary Data
application/java-archive
Java Archive
application/JPEGView
OS/2 Bitmap
application/mac-binhex40
Binhex File
application/MacAmp
MPEG-1 Layer 3 Table continued on following page
1438
M – MIME types (Definition)
MIMEType
Description
application/MacAnim_Viewer
DL Animation
application/macbinary
MacBinary
application/MacBooz
Zoo Archive
application/MacLHA
LHArc Archive
application/macwriteii
MacWrite Document
application/Microsoft_Word
Word for Windows Template
application/MoviePlayer
DV Video
application/ms-powerpoint
application/MS-PowerPoint
application/msword
Word Document
application/netcdf
Channels
application/octet-stream
Binary Executable
application/oda
ODA Document
application/PageMaker
PageMaker 3 Document
application/pdf
PDF File
application/PF_Encrypt
Private File
application/pgp-keys
PGP Key File
application/Photoshop
PhotoShop Document
application/PictureViewer
OS/2 Bitmap
application/PlayerPro
669 MOD Music
application/postscript
PostScript File
application/pre-encrypted
Pre-encrypted Data
application/QuarkXpress
QuarkXpress Document
application/Replica
Replica Document
application/ResEdit
Resource File
application/rtf
Rich Text Format File
application/sdp
Session Description Protocol
application/self-extracting
Self-Extracting Archive
application/Self_Extracting_Archive
Self-Extracting Archive
application/SimpleText
Apple documentation file
application/smil
SMIL Document
application/SoftWindows
MS-DOS Executable
application/SoundApp
Amiga OctaMed music
application/SoundHack
IRCAM Sound
application/streamingmedia
Standard Streaming Metafile
application/StuffIt
StuffIt Archive
application/StuffIt_Expander
PackIt Archive
application/SunTar
Unix BAR Archive
application/vnd.fdf
Forms Data Format Table continued on following page
1439
JavaScript Programmer's Reference
MIMEType
Description
application/vnd.lotus-1-2-3
Lotus 123 Document
application/vnd.lotus-approach
Lotus Approach Document
application/vnd.lotus-freelance
Lotus Freelance Document
application/vnd.lotus-organizer
Lotus Organizer Document
application/vnd.lotus-screencam
Lotus ScreenCam Movie
application/vnd.lotus-wordpro
Lotus WordPro Document
application/vnd.ms-access
Microsoft Access Database
application/vnd.ms-excel
Excel Worksheet
application/vnd.ms-powerpoint
PowerPoint Presentation
application/vnd.ms-schedule
Microsoft Schedule+ Application
application/vnd.rn-realmedia
RealMedia File
application/vnd.rn-realplayer
RealPlayer File
application/vnd.rn-realsystem-rjs
RealSystem Skin
application/vnd.rn-realsystem-rmx
RealSystem Secure Media Clip
application/vnd.rn-rn_music_package
RealJukebox Music Package
application/vnd.rn-rsml
RealSystem ML File
application/waf
Website Archive
application/WordPerfect
WordPerfect PC 4.2 Doc
application/wordperfect5.1
WordPerfect PC 5.1 Doc
application/x-authorware-map
Authorware
application/x-cdf
Channels
application/x-compress
Unix Compressed (.z) Files
application/x-compressed
application/x-compressed
application/x-conference
application/x-conference
application/x-cpio
Unix CPIO Archive
application/x-csh
C Shell Program
application/x-director
Shockwave
application/x-dvi
TeX DVI Document
application/x-excel
application/x-excel
application/x-fortezza-ckl
Compromised Key List
application/x-gocserve
CompuServe Inbound Link to CIM 3.0
application/x-gtar
GNU Tape Archive
application/x-gzip
GZIP File
application/x-hdf
HDF Data File
application/x-JavaScript
A .js file containing JavaScript source code
application/x-javascript
JavaScript Program
application/x-javascript-config
JavaScript Config
application/x-javascript-config
JavaScript Config Table continued on following page
1440
M – MIME types (Definition)
MIMEType
Description
application/x-latex
LaTeX Document
application/x-macbinary
MacBinary File
application/x-netcdf
Channels
application/x-ns-proxy-autoconfig
Proxy Auto-Config
application/x-perl
Perl Program
application/x-pkcs7-crl
Certificate Revocation List
application/x-pkcs7-mime
PKCS7 Encrypted Data
application/x-pkcs7-signature
PKCS7 Signature
application/x-rtsp
Real Time Streaming Protocol
application/x-sdp
Scalable Multicast
application/x-sgml
SGML Document
application/x-sh
Bourne Shell Program
application/x-shar
Unix Shell Archive
application/x-shockwave-flash
Shockwave Flash
application/x-stuffit
Stuffit Archive
application/x-tar
TAR Archive
application/x-tcl
TCL Program
application/x-tex
TeX Document
application/x-texinfo
GNU TeXinfo Document
application/x-x509-ca-cert
Certificates
application/x-zip-compressed
Zip Compressed Data
application/xml
HTML Document
application/zip
ZIP Archives
audio/aiff
AIFF Audio
audio/basic
AU Audio
audio/mid
MIDI
audio/midi
MIDI
audio/mp3
MPEG Movie
audio/mpeg
MPEG audio stream
audio/mpegurl
MP3 PlayLists (.m3u,.pls)
audio/mpg
MP3 Audio
audio/rmf
audio/rmf
audio/scpls
MP3 PlayLists (.m3u,.pls)
audio/vnd.qcelp
QCP Audio
audio/vnd.rn-realaudio
RealAudio Clip
audio/wav
WAV Audio
audio/x-aiff
AIFF Audio
audio/x-midi
MIDI Table continued on following page
1441
JavaScript Programmer's Reference
MIMEType
Description
audio/x-mp3
MPEG Movie
audio/x-mpeg
MPEG audio stream
audio/x-mpegurl
MP3 PlayLists (.m3u,.pls)
audio/x-mpg
MP3 Audio
audio/x-pn-realaudio
RealAudio
audio/x-pn-realaudio-plugin
RealPlayer Plugin
audio/x-rmf
audio/x-rmf
audio/x-scpls
MP3 PlayLists (.m3u,.pls)
audio/x-wav
WAV Audio
image/gif
GIF Image
image/ief
IEF image
image/jpeg
JPEG Image
image/pict
PICT Image
image/png
PNG Image
image/tiff
TIFF Image
image/vnd.rn-realflash
RealFlash Clip
image/vnd.rn-realpix
RealPix Clip
image/x-bmp
Windows BMP Image
image/x-cmu-raster
CMU Raster Image
image/x-fits
Flexible Image Transport
image/x-macpaint
MacPaint Image
image/x-macpict
PICT Picture
image/x-MS-bmp
Windows Bitmap
image/x-pbm
Portable Bitmap
image/x-pgm
Portable Graymap
image/x-photo-cd
PhotoCD Image
image/x-photoshop
Photoshop Image
image/x-pict
PICT Image
image/x-png
PNG Image
image/x-portable-anymap
PBM Image
image/x-portable-bitmap
Portable Bitmap
image/x-portable-graymap
Portable Graymap
image/x-portable-pixmap
Portable Pixmap
image/x-ppm
Portable Pixmap
image/x-quicktime
QuickTime Image
image/x-rgb
SGI Image
image/x-sgi
SGI Image
image/x-targa
Targa Truevision Image Table continued on following page
1442
M – MIME types (Definition)
MIMEType
Description
image/x-tiff
TIFF Image
image/x-xbitmap
X Bitmap Image
image/x-xbm
X-Windows Bitmap
image/x-xpixmap
X-Windows Pixmap
image/x-xpm
X-Windows Pixmap
image/x-xwd
X-Windows Dump
image/x-xwindowdump
X Window Dump Image
image/xbitmap
X Bitmap Image
image/xbm
X Bitmap Image
message/external-body
URL Bookmark
Netscape/Source
Special file type
Netscape/Telnet
Netscape Telnet session
Netscape/tn3270
Netscape TN3270 session
text/cdf
Channels
text/css
Text File
text/html
An HTML document.
text/JavaScript
Text formatted JavaScript source code inside a <SCRIPT> block
text/Jscript
Text formatted JScript source code inside a <SCRIPT> block
text/plain
Form content and other plain text documents
text/url
URL File
text/vbs
Text formatted VBScript source code inside a <SCRIPT> block
text/vbscript
Text formatted VBScript source code inside a <SCRIPT> block
text/vnd.rn-realtext
RealText Clip
text/x-cdf
Channels
text/x-vcard
Visiting Card
text/xml
HTML Document
undefined
UUEncoded Data
video/avi
Microsoft Video
video/flc
FLC Animation
video/mpeg
MPEG video/audio stream
video/msvideo
Microsoft Video
video/quicktime
QuickTime Movie
video/vnd.rn-realvideo
RealVideo Clip
video/x-mpeg
MPEG video/audio stream
video/x-mpeg2
MPEG2 Video
video/x-msvideo
Microsoft Video
video/x-qtc
video/x-qtc
x-world/x-3dmf
QuickDraw 3D File
x-world/x-vrml
VRML File
1443
JavaScript Programmer's Reference
MIME stands for Multi-part Internet Mail Extension but its usefulness has gone way beyond the scope of a simple extension to the mail protocols. See also:
<SCRIPT ARCHIVE="...">, <SCRIPT SRC="...">, <SCRIPT TYPE="...">, <STYLE TYPE="...">, Anchor.mimeType, Anchor.type, blob.blobLink(), BUTTON.accept, Document.open(), Form.encoding, JavaScript Image Source URL, LINK.type, MimeType object, MimeType.type, OBJECT.codeType, OBJECT.type, style.cueAfter, style.cueBefore, text/JavaScript, XML.type
Cross-references: Wrox Instant JavaScript – page – 42
MimeType object (Object/browser) An object representing a MIME type. Availability:
JavaScript syntax:
JavaScript – 1.1 JScript – 3.0 Internet Explorer – 4.0 Netscape – 3.0 myMimeType = myWindow.navigator.mimeTypes[anIndex] myMimeType = navigator.mimeTypes[anIndex] -
myMimeType = myMimeTypeArray[anIndex]
Argument list:
anIndex
A reference to an element in a collection
Object properties:
description, enabledPlugin, name, suffixes, type
Collections:
suffixes[]
The example code fragment will list all the available MIME types supported by the browser.
Example code: // List the available mimeTypes for(ii=0; ii tags in the Netscape Enterprise Server or with Microsoft ASP. SEWSE is called as part of the CGI mechanism in the web server. The Script Ease Desk Top implementation provides a way to use JavaScript to control desktop actions. This is available cross-platform and accomplishes the kind of things you might do with AppleScript on a Macintosh or Windows Script Host in the Microsoft Windows environment. The SEWSE interpreter can also be used for general purpose scripting in the Unix environment in much the way you would use Bourne, Korn or C shells or the Perl interpreter. You can also embed Script Ease into your own applications and add scriptability to them. See also:
1538
Standalone JavaScript
N – Nondigit (Definition)
Nondigit (Definition) A non-digit letter that can be used in an identifier. In the context of creating identifier names, a non-digit character is a member of the following set: a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ (Underscore) See also:
Digit, Identifier
(HTML Tag) A special tag that allows browsers that don't support scripting to display alternative content. Availability:
JavaScript – 1.1 JScript – 3.0 Internet Explorer – 4.0 Netscape – 3.0
Browsers that support the <SCRIPT> tag should also support the tag. However, their support for the tag should be to hide or ignore anything between the tag and its corresponding closure.
Warnings: ❑
This is not supported by Netscape 2. See also:
<SCRIPT>, Compatibility
NOSCRIPT object (Object/HTML) An object representing the tag. Availability:
JScript – 3.0 Internet Explorer – 4.0
Inherits from:
Element object
1539
JavaScript Programmer's Reference
JavaScript syntax:
IE
myNOSCRIPT = myDocument.all.anElementID
IE
myNOSCRIPT = myDocument.all.tags("NOSCRIPT")[anIndex] myNOSCRIPT = myDocument.all[aName]
IE HTML syntax: Argument list:
myNOSCRIPT = myDocument.getElementById(anElementID) myNOSCRIPT = myDocument.getElementsByName(aName)[anIndex] myNOSCRIPT = myDocument.getElementsByTagName ("NOSCRIPT")[anIndex]
... anIndex
A reference to an element in a collection
aName
An associative array reference
anElementID
The ID value of an Element object
Object properties:
accessKey, tabIndex, dir
Event handlers:
onClick, onDblClick, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp
This was added to the MSIE browser at revision 4. It is a sub-class of the basic Element object and therefore shares many properties with other objects in the MSIE browser. Although it is implemented as an Element, it is not a DOM-specified item. See also:
Element object, NOFRAMES object
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
accessKey tabIndex dir
-
3.0 + 3.0 + 5.0 +
-
4.0 + 4.0 + 5.0 +
-
-
-
-
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick onDblClick onHelp onKeyDown onKeyPress onKeyUp onMouseDown onMouseMove onMouseOut onMouseOver onMouseUp
-
3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 + 3.0 +
-
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 +
-
-
4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 +
Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning Warning
1540
N – NOSCRIPT.dir (Property)
Inheritance chain: Element object, Node object
NOSCRIPT.dir (Property) The direction of rendering of text contained within the block owned by the tag. Availability:
JScript – 5.0 Internet Explorer – 5.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myNOSCRIPT.dir
The dir property may be set to indicate a left-to-right or right-to-left parsing direction. This is part of the localization support and represents the contents of the DIR="..." tag attribute. If you assign a value to this property it is case-sensitive and must be either "ltr" or "rtl". Note that this is at variance with some documentation which says it is case-insensitive. This property works in conjunction with the lang property to control the direction of text flow. See also:
BDO.dir, Element.dir, NOFRAMES.dir
Not a number (Definition) A special numeric value used to handle computational error conditions. Availability:
ECMAScript edition – 2
Property/method value type:
Number primitive
IEEE 754 describes a numeric regime that includes the ability to flag exceptions when calculations generate invalid results. The result of such an expression may be signified by the NaN or Not a Number exception. See also:
IEEE 754, NaN
Cross-references: ECMA 262 edition 2 – section – 4.3.23 ECMA 262 edition 3 – section – 4.3.23
1541
JavaScript Programmer's Reference
NOT Equal to (!=) (Operator/equality) Compare two operands for inequality. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server version – 2.0 Opera – 3.0
Property/method value type:
Boolean primitive
JavaScript syntax:
-
anOperand1 != anOperand2
anOperand1
A value to be compared
anOperand2
Another value to be compared
Argument list:
The two operands are compared, and the Boolean true value is returned if they are not equal, otherwise false if they are equal. Note that JavaScript will attempt to convert both operands to the same type for comparison. When testing for inequality, the following rule is invariant: A != B
is equivalent to: !(A == B)
Also, the rule of positioning allows that: A == B
is identical to: B == A
(Apart from the fact that exchanging the operands in this way alters the order in which they are evaluated.) Exchanging the operands may have undesirable side effects if they are expressions. For example, they may call functions and test the results. If the functions are not totally independent of one another, you may get unexpected results. The associativity is from left to right. Refer to the Operator Precedence topic for details of execution order. Refer to the Equality expression topic for a discussion on the ECMA standard definition of the equality testing rules.
1542
N – NOT Identically equal to (!==) (Operator/identity)
See also:
ASCII, Associativity, Equal to (==), Equality expression, Equality operator, Greater than (>), Greater than or equal to (>=), Identically equal to (===), Less than ( // Define a function that extends the capabilities of the Number object function pythag(aValue1, aValue2) { return Math.sqrt((aValue1*aValue1) + (aValue2*aValue2)); } // Register the new function Number.prototype.pythag = pythag; // Create a number object and test the Number.pythag() method myNumber = new Number(); document.write(myNumber.pythag(3, 4)); document.write("
");
See also:
Property attributes: DontDelete, DontEnum.
1560
Number object, Number(), Number(), Number.constructor, Number.toString(), Number.valueOf(), prototype property
N – Number.toExponential() (Method)
Cross-references: ECMA 262 edition 2 – section – 15.2.3.1 ECMA 262 edition 2 – section – 15.7.4 ECMA 262 edition 3 – section – 15.7.3.1
Number.toExponential() (Method) Converts the number to an exponential format representation. Availability:
ECMAScript edition – 3 JavaScript – 1.5 JScript – 5.5 Internet Explorer – 5.5 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myNumber.toExponential(aNumber)
Argument list:
aNumber
The number of digits after the decimal point
This method is useful for formatting number values. This is especially helpful when presenting tables of scientific data, which may require values of a wide range of magnitudes to be presented in a similar way. The argument value indicates the precision or decimal places of accuracy to the right of the decimal point character. If the argument is undefined, then as many digits as are necessary to completely distinguish the value are presented (up to the mathematical accuracy of the implementation). See also:
Number.toFixed(), Number.toPrecision(), Number.toString()
Cross-references: ECMA 262 edition 3 – section – 15.7.4.6
Number.toFixed() (Method) Converts the number to a fixed format representation. Availability:
ECMAScript edition – 3 JavaScript – 1.5 JScript – 5.5 Internet Explorer – 5.5 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myNumber.toFixed(aNumber)
Argument list:
aNumber
The number of digits after the decimal point
1561
JavaScript Programmer's Reference
This method is useful for truncate formatting number values. This is especially helpful when presenting tables of financial data that needs to be justified and padded to the same number of digits after the decimal point. The argument value indicates the precision or decimal places of accuracy to the right of the decimal point character. If the argument is undefined, then zero is assumed and the value will be presented as an integer. This method may be useful for performing truncations from floating point to integer value. The output of this method may also be more precise when a large number of integer digits are required to present the number. According to the ECMA standard, the alternative toString() method loses some accuracy for numbers having 19 digits for example. See also:
Number.toExponential(), Number.toPrecision(), Number.toString()
Cross-references: ECMA 262 edition 3 – section – 15.7.4.5
Number.toLocaleString() (Method) Converts a number to a string taking locale-specific settings into account. Availability:
ECMAScript edition – 3 JavaScript – 1.5 JScript – 5.5 Internet Explorer – 5.5 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myNumber.toLocaleString()
Locale conventions may include special formatting of numbers such as thousands separators and decimal point symbols. The number will be converted according to the rules defined by the implementation's locale setting.
Warnings: ❑
ECMA warns that the first argument of this method is reserved for future use. Beware if your implementation makes use of an argument in this method as it may be non-compliant with a later version of the ECMA standard.
Cross-references: ECMA 262 edition 3 – section – 15.7.4.3
1562
N – Number.toPrecision() (Method)
Number.toPrecision() (Method) Convert a number to a string automatically selecting fixed or exponential notation. Availability:
ECMAScript edition – 3 JavaScript – 1.5 JScript – 5.5 Internet Explorer – 5.5 Netscape – 6.0
Property/method value type:
String primitive
JavaScript syntax:
-
myNumber.toPrecision(aNumber)
Argument list:
aNumber
The number of digits after the decimal point
This method will convert a number to a string and will select either a fixed or exponential notation according to the magnitude of the value being converted. This would be useful where you have an arbitrary collection of values and don't want them presented in a ragged looking column. See also:
Number.toExponential(), Number.toFixed()
Cross-references: ECMA 262 edition 3 – section – 15.7.4.7
Number.toSource() (Method) Output a number formatted as a Number literal contained in a string. Availability:
ECMAScript edition – 3 JavaScript – 1.3 Netscape – 4.06
Property/method value type:
String primitive
JavaScript syntax:
-
myNumber.toSource()
This is an alternative way to deliver a string version of a number value. In this case, it is formatted as a Number literal and can then be used in an eval() function to assign another number. If you run the example below, it should yield this as a result: (new Number(1000))
The result of calling this method is a string version of the number formatted as a Number literal.
1563
JavaScript Programmer's Reference
Example code: // Create a number and then examine its source myNumber = new Number(1000); document.write(myNumber.toSource());
Number.toString() (Method) Return a string primitive version of an object. Availability:
ECMAScript edition – 2 JavaScript – 1.1 JScript – 1.0 Internet Explorer – 3.02 Netscape – 3.0 Opera – 3.0
Property/method value type:
String primitive
JavaScript syntax:
-
myNumber.toString(aRadix)
Argument list:
aRadix
A radix to base the string conversion of the value on
The result of this method is a String primitive representation of the numeric value of the receiving object, rendered according to the passed-in radix value. A radix is the number of discrete values in the counting sequence before a carry over digit is generated. Thus, the radix of decimal numbers is 10. With this mechanism, you can generate values to any radix. The radix is also called the base of the number system. The radix value is in the range 2 to 36 and allows the numeric value to be reproduced in a variety of number bases. ❑
A missing radix is assumed to be base 10.
❑
Octal numbers use a radix value of 8.
❑
Hexadecimal numbers use a radix value of 16.
❑
Binary numbers use a radix value of 2.
For an example, refer to the Decimal value topic where this is used to generate a lookup table. Before the radix conversion was available, this method simply converted to a string, which most commentators considered was unnecessary since JavaScript did this naturally without any need to add special scripting support. However, now that we can convert numeric values from one base to another, this function becomes far more useful. See also:
1564
Cast operator, Decimal value, Hexadecimal value, Number.prototype, Number.toExponential(), Number.toFixed(), Octal value, toString()
N – Number.valueOf() (Method)
Cross-references: ECMA 262 edition 2 – section – 15.7.4.2 ECMA 262 edition 3 – section – 15.7.4.2
Number.valueOf() (Method) Return the primitive numeric value of the object. Availability:
ECMAScript edition – 2 JavaScript – 1.1 JScript – 3.0 Internet Explorer – 4.0 Netscape – 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
myNumber.valueOf()
A Number object is converted to a simple Number primitive. You probably won't need to do this very often yourself because JavaScript is smart enough to convert Number primitives to Number objects and vice versa whenever it needs to. This is a whole lot better than having to cast data types to get expressions to work, as you would have to in other programming languages. This help makes JavaScript very accessible to non-programmers. See also:
Cast operator, Number.prototype, valueOf()
Cross-references: ECMA 262 edition 2 – section – 15.7.4.3 ECMA 262 edition 3 – section – 15.7.4.4
Numeric literal (Primitive value) A literal constant whose type is a built-in primitive value. Availability:
ECMAScript edition – 2
Property/method value type:
Number primitive
Numeric literals are constant numeric values expressed in Decimal, Hexadecimal, or Octal notation. Numeric values can be integer or floating-point. Floating-point values can be specified with exponential notation.
1565
JavaScript Programmer's Reference
Hexadecimal values must always be integers, thus: ❑
0xFF
❑
0XABCD
Octal values must always be integers, must start with a zero and contain only the characters 0–7. The standard does not mandate any particular rounding technique but recommends the use of IEEE 754 standard numeric computation. This standard has been in existence for some time now and is likely to be the foundation numeric computation standard in most platforms. See also:
Floating constant, Implicit conversion, Literal, Number formats (.)
Cross-references: ECMA 262 edition 2 – section – 7.7.3 ECMA 262 edition 3 – section – 7.8.3
Numerical limits (Definition) Limiting conditions for arithmetic values.
Refer to: Limits
1566
O Obfuscation (Advice) Needless complexity in the arrangement of tokens in a line of executable script. There are competitions on the Internet to write the most egregious and highly functional code fragment in the fewest lines of code. This is particularly easy to do in C language. Certain operators lend themselves to the construction of extremely terse code, which, although functionally very clever, is also very hard to understand when diagnosing faults or carrying out maintenance. This entry is not to recommend against the use of such operators, but to urge a word of caution on the basis that modern language parsing and execution engines may be smart enough to highly optimize the code, making any performance gains negligible anyway. These days, it is quite difficult to yield any noticeable performance gains by epitomizing the code at the source level with compiled systems. There may still be some gains to be won with interpreted code. A badly designed algorithm may continue to perform badly in an interpreter where there is a possibility it might get corrected in an optimizing compiler. The operators to be particularly cautious about are the assignment operators and the prefix/postfix operators. The ternary conditional operator is also hard to read in source and may offer little advantage over an if(… ) … else construct. These are equivalent but intent is much more obvious withthe if(… ) … else form: // Conditional ternary operator myResult = (mySwitch) ? "TRUE VALUE" : "FALSE VALUE" ; // Conditional block if(mySwitch) { myResult = "TRUE VALUE";} else { myResult = "FALSE VALUE";}
JavaScript Programmer's Reference
Where this causes particular problems is in the maintenance phase where you might perhaps be adding another line of code. In cutting and pasting an existing line, it can be easy to overlook an operator and accidentally increment something twice or assign a value inadvertently. Special care is necessary with iterators and conditional execution blocks. A particularly nasty habit is to have a condition that when true, executes one statement. This is frequently written into the source text without any enclosing braces. Those braces are important because they group the block of code into a single syntactical unit. When you later try to unpick someone else's script, the indentation may fool you into seeing several lines that appear to be conditionally executed when in fact only one is. The same applies to iterators as well. It is highly recommended that you put in the braces where they are required for multiple line conditional code and iterator blocks even when there is only one line of code being executed. This safeguards against errors when more lines are added to the conditional or iterated code block later on. This is not recommended practice: if(aCondition) someCode; while(aCondition) someCode; for( ... ) someCode; This is slightly better but requires more effort when adding lines to the code block: if(aCondition) someCode; while(aCondition) someCode; for( ... ) someCode;
This is less dangerous than having no braces but makes the line long and twice as hard to scan visually: if(Condition) { someCode }
This is fashionable, but the braces are hard to balance visually: if(aCondition) { someCode }
1568
O – Object (Definition)
This is good because it thinks ahead to the possibility of maintenance and tends towards fewer editing errors: if(aCondition) { someCode } while(aCondition) { someCode } for( ... ) { someCode }
If there is any downside to this it is that every balanced pair of braces will create a new execution context. This may slow performance, but on the other hand it can allow locally scoped variables to be created and destroyed at a level that is more granular than a function body. There is also scope for a religious debate on indentation. Three space characters works great (for me). I don't like tabs because if you move the source code to another editor, the indentation can go awry. Space characters for indentation ensure that the source code looks the same in any monospaced editing window and probably looks OK in a word processor too. See also:
Flow control, if( ... ) ..., while( ... ) ...
Object (Definition) There is a distinct difference between an object and an Object. We refer to the built-in Object class with a capitalised name. When referring generically to objects of other classes, the word object is all lower case. Therefore we can have an Object object and a String object. Native objects are built-in, host objects are also built in but created outside of the JavaScript core functionality. User-defined objects are not covered here.
1569
JavaScript Programmer's Reference
Here is a list of object classes with a note about what sort of object they are and when how they are managed: Class
Category
Description
Array Boolean Date Function Global Image Math Number Object String
Native Native Native Native Built-in Hosted Built-in Native Native Native
A collection of objects in a sequence A logical value container A date value container A function code container A container for global properties, methods, and functions Web browser image wrapper A container for math functions A numeric value A generic object A sequence of characters
Because you might refer to documents in many ways, possibly by means of object properties or as a property belonging to another window, it is not safe to assume that the document property belonging to the Global object the script is attached to is always the document object you are trying to access. Because of this, the object references in the syntax examples assume the object is being referred to via a variable called myDocument or myObject etc. For example, the value myDocument is shown being assigned as a variable from the many alternative sources from which you can obtain a document object reference.
Object (Type) A native built-in type. Availability:
ECMAScript edition – 2
An Object is an unordered collection of properties. Each property consists of a name, a value and a set of attributes. See also:
Alias, Data Type, Definition, Internal Method, Internal Property, Object object, Property, Property attribute, Type
Cross-references: ECMA 262 edition 2 – section 8.6 ECMA 262 edition 3 – section 8.6 Wrox Instant JavaScript – page 28
1570
O – Object constant (Definition)
Object constant (Definition) Constant objects. There are some constant objects defined by the standard. A host implementation may provide a few more. Here is a summary of the basic set of constant objects: ❑
Array constructor
❑
Boolean constructor
❑
Date constructor
❑
Function constructor
❑
Global object
❑
Math object
❑
Number constructor
❑
Object constructor
❑
RegExp constructor See also:
Array(), Boolean(), Closure(), Constant expression, Date(), Function(), Global object, Math object, Number(), Object literal, Object()
Cross-references: Wrox Instant JavaScript – page 28
Object inspector (Useful tip) A debugging tool for inspecting object properties and classes. Here is a small debugging utility that breaks an object down and displays some of its properties.
Example code: <SCRIPT ARCHIVE="./test.jar" SRC="test1.js"> <SCRIPT ARCHIVE="./test.jar" SRC="test2.js"> <SCRIPT> document.write(test1()); document.write("
"); document.write(test2()); document.write("
");
See also:
.jar, .js, <SCRIPT SRC="...">, <SCRIPT>, Adding JavaScript to HTML, File extensions, Inline script, MIME types, Security policy
<SCRIPT EVENT="..."> (HTML Tag Attribute) A tag attribute to associate a script block with an event to be handled. Availability:
JScript – 3.0 Internet Explorer – 4.0
This HTML tag attribute is quite useful when using ActiveX controls in web pages. You can use this to attach a fragment of script to an event so that the screen gets updated. Here is a skeleton of some HTML that attaches a script to an object that has been embedded: <SCRIPT FOR="Xbutton" EVENT="Click()"> // Do some kind of stuff in here as a // result of the ActiveX calling this <SCRIPT> The CLASSID, CODEBASE, and other parameters depend on the ActiveX control you are embedding. The point to make here is that as the page is loaded, the control will be displayed and when the user clicks on it, the browser makes the association by mapping the FOR="..." HTML tag attribute in the <SCRIPT> tag to the ID="..." attribute of the tag. Then the event that the control triggers is mapped to the EVENT="..." HTML tag attribute of the <SCRIPT> tag. You can create a whole set of <SCRIPT> blocks, one for each event and control you expect to use. This means the browser does the mapping and dispatching of events for you. See also:
1884
<SCRIPT>, Event handler in <SCRIPT>, Script execution
Error! No text of specified style in document.
<SCRIPT FOR="..."> (HTML Tag Attribute) A tag attribute to associate a script block with an input element or for mapping script blocks to objects embedded in web pages. Availability:
JScript – 3.0 Internet Explorer – 4.0
See also:
<SCRIPT EVENT="...">, <SCRIPT>, Script execution
Refer to: Event handler in <SCRIPT>
<SCRIPT ID="..."> (HTML Tag Attribute) Script blocks can be given ID values so they can be identified within the document scripts array. If you can identify a script block by its ID value, you should be able to locate the object and at least read the contents of the script block. Some browsers may let you change the script block but it has always been recommended practice to avoid self-modifying code. See also:
Document.scripts[]
<SCRIPT LANGUAGE="..."> (HTML Tag Attribute) The required version of JavaScript to interpret the enclosed code. HTML syntax: Argument list:
<SCRIPT LANGUAGE="..."> someCode ...
The script language to use for this block of script source
someCode
Some script source text
As you embed the script code into an HTML page with the <SCRIPT> tag, you can indicate by means of the LANGUAGE attribute which version of JavaScript (or indeed other scripting languages) the interpreter should use to process the script. This is subtle and allows various aspects of the language to be switched so that they behave differently according to the version selection. It also provides a way to hide JavaScript written according to newer syntax conventions from older browsers that cannot cope with it. In general, you should always try to specify the lowest version of JavaScript to achieve maximum portability. JavaScript version 1.2 implemented some different capabilities regarding equality tests where the operands were different types. Selecting LANGUAGE="JavaScript" as opposed to LANGUAGE="JavaScript1.2" affects how these tests are carried out when the script is executed.
1885
Chapter number
The following values are legal for the <SCRIPT> tag's LANGUAGE attribute: Attribute Value
Description
Nothing, attribute omitted JavaScript
Basic JavaScript functionality.
JavaScript1.1
Version 1.1 language capabilities.
JavaScript1.2
Version 1.2 language capabilities.
JavaScript1.3
Version 1.3 language capabilities.
JavaScript1.4
Version 1.4 language capabilities.
JavaScript1.5
Version 1.5 language capabilities.
VBScript
Visual BASIC scripting in MSIE browsers.
Tcl
In the HTML 4.0 specification, Tcl is used as an example.
Basic JavaScript functionality.
The example below will display the text 1.3 in a Netscape 4.7 browser and the value 1.4 in version 5 of MSIE for Macintosh. Note with this technique that you should ensure you test for a high enough version. The browsers will execute the versions indicated. If you only test up to version 1.2, then the variable assignment is never going to reflect a 1.4 version capability.
Warnings: ❑
If a browser does not support the specified language, it may not execute the script block, even with a degraded version of the interpreter.
❑
Be aware that Netscape 4 supports some special capabilities in JavaScript version 1.2 mode that are not strictly correct according to the ECMA standard nor are they compatible with earlier versions of Netscape Navigator and other browsers. If you find that you need to turn on JavaScript version 1.2 with the LANGUAGE attribute, check your scripts for portability very carefully.
Example code: <SCRIPT LANGUAGE="VBScript"> function getArray() dim arrVB(1) arrVB(0) = 100 arrVB(1) = 250 getArray = arrVB End function <SCRIPT LANGUAGE="JavaScript"> var vbArr = new VBArray(getArray()); alert(vbArr.dimensions());
Method
JavaScript
JScript
N
IE
Opera
Notes
dimensions()
-
3.0 +
-
4.0 +
-
-
getItem()
-
3.0 +
-
4.0 +
-
-
lbound()
-
3.0 +
-
4.0 +
-
-
toArray()
-
3.0 +
-
4.0 +
-
-
ubound()
-
3.0 +
-
4.0 +
-
-
VBArray() (Constructor) A constructor function for creating new VBArray objects. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
VBArray object
JavaScript syntax:
IE
new VBArray(aVisBasArray)
Argument list:
aVisBasArray
An array created inside Visual Basic or VBScript
This constructor would be useful if you are interacting with Visual Basic scripts or functions that need to have an array passed to them.
2371
Chapter number
VBArray.dimensions() (Method) A method for requesting the number of dimensions of the array. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myVBArray.dimensions()
This tells you the number of axes in the array; you can then determine the maximum size they are expected to occupy with the lbounds() and ubounds() methods.
VBArray.getItem() (Method) An accessor method for retrieving items from the array. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
User defined
JavaScript syntax:
IE
myVBArray.getItem(anIndex)
IE
myVBArray.getItem(anIndex1, anIndex2, ...)
anIndex
A reference to an item in the array
anIndexN
As many dimensions as are required to address the required item
Argument list:
This acessor method is used to extract the values from cells within the array. You cannot address the cells directly as you would with a native JavaScript, array although you can convert the VBArray to a native JavaScript array. Be careful though with multi-dimensional arrays. You can use the dimensions() method to find out how many axes there are for addressing a multidimensional array. The lbounds() and ubounds() methods can be used to determine the extent of those axes.
VBArray.lbound() (Method) A method that returns the index position of the first element in the VBArray. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myVBArray.lbound(aDimension)
Argument list:
aDimension
The dimension for which the lower bounds is required
This is the lower boundary value for the indicated dimension. You will need to measure this for each dimension individually if the array is multi-dimensional.
2372
Error! No text of specified style in document.
VBArray.toArray() (Method) A conversion method for creating a JScript array object from a VBArray object. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Array object
JavaScript syntax:
IE
myVBArray.toArray()
You can convert an entire Visual Basic array to a JScript array. It is possible some data will get lost along the way but simple data formats should survive the translation. Multi-dimensional arrays consume a great deal more memory than you anticipate. The compounded effect of adding each dimension usually increases storage by at least an order of magnitude each time. See also:
Array object
VBArray.ubound() (Method) A method that returns the index position of the last element in the VBArray. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myVBArray.ubound(aDimension)
aDimension
The dimension for which the upper bounds is required
Argument list:
This is the upper boundary value for the indicated dimension. You will need to measure this for each dimension individually if the array is multi-dimensional.
vCard object (Object/JScript) This is an object accessible only through the user preferences interface in the MSIE browser. Availability:
JScript – 3.0 Internet Explorer – 4.0
The vCard object is the parent object that contains all the user preferences settings.
2373
Chapter number
There are basically three kinds of properties: ❑
Those that are members of the vCard.Business object
❑
Those that are members of the vCard.Home object
❑
Those that are members of the vCard object directly
Here is a list of all the user preference attributes that you can request: ❑
vCard.Business.City
❑
vCard.Business.Country
❑
vCard.Business.Fax
❑
vCard.Business.Phone
❑
vCard.Business.State
❑
vCard.Business.StreetAddress
❑
vCard.Business.URL
❑
vCard.Business.Zipcode
❑
vCard.Cellular
❑
vCard.Company
❑
vCard.Department
❑
vCard.DisplayName
❑
vCard.Email
❑
vCard.FirstName
❑
vCard.Home.City
❑
vCard.Home.Country
❑
vCard.Home.Fax
❑
vCard.Home.Phone
❑
vCard.Home.State
❑
vCard.Home.StreetAddress
❑
vCard.Home.Zipcode
❑
vCard.Homepage
❑
vCard.JobTitle
❑
vCard.LastName
❑
vCard.MiddleName
❑
vCard.Notes
❑
vCard.Office
❑
vCard.Pager See also:
2374
Navigator.userProfile, userProfile.addReadRequest(), userProfile.getAttribute()
Error! No text of specified style in document.
Version History (Background) Historical details of JavaScript versions. See also:
JavaScript version, JScript version, History
view-source: URL (Request method) You can use this for debugging in both Netscape and MSIE. This is a useful debugging aid in some circumstances. Sometimes it is hard to download a file and this may give you a workaround. To display a window containing the HTMLized version of a directory in the client machine, try this: view-source:/
It works at least on Netscape Navigator version 4.7 on a Macintosh. It likely works on other platforms and versions of Netscape too. The top level directory is the folder in which Netscape lives. On a Macintosh at least, you can append a disk volume name, like this: view-source:/MacintoshHD/
Beyond that you can build a path to any document in the Macintosh system, including this, which is very interesting. view-source:/MacintoshHD/System%20Folder/System
This displays a preferences file: view-source:/MacintoshHD/System%20Folder/Preferences/Fetch%20Shortcuts
With this level of read access to your client machine, you might be able to browse various file content that normally you wouldn't have time to do. Point at a file and its data is visible right there on the screen in a browser window.
Warnings: ❑
Be very careful what you browse and how. This may void your warranty. Your mileage may vary. You may corrupt your system although read-only access is unlikely to cause any harm. See also:
file: URL, javascript: URL, URL
2375
Chapter number
Visual filters (Definition) The MSIE browser in version 4.0 and upwards now supports visual transition effects to use when modifying page content or navigating from page to page. These filters have been enhanced and added to at version 5.0 and 5.5 of JScript. As of version 5.5 of MSIE, the performance of these filters is also optimized and enhanced. The following kinds of visual filters are supported: ❑
Procedural surfaces
❑
Static filters
❑
Transitions See also:
Procedural surfaces, Static filters, style.filter
void (Operator/unary) Force an undefined value to replace an operand. Availability:
ECMAScript edition – 2 JavaScript – 1.1 JScript – 2.0 Internet Explorer – 4.0 Netscape version – 3.0 Opera browser – 3.0
Property/method value type:
Undefined primitive
JavaScript syntax:
-
void (anExpression)
anExpression
void anExpression
Argument list:
An expression to be evaluated
The void operator is used to allow the operand to be evaluated in the normal way (perhaps it is an expression or function call), but to force an undefined value to be returned in its place. A very useful place for this is when you create JavaScript: URLs. Making sure the result of the expression is void helps the browser cope with the fact you are calling a script and not fetching a document. Don't use void however if you want the result of the JavaScript execution to be used as the content of a window. This shows how to use void in a click handler:
2376
Error! No text of specified style in document.
This shows how to force JavaScript result data into a window: You can also use the void operator to manufacture an undefined value in older browsers that have no keyword already defined. The expression (void 0) is just such a value. This is unnecessary now that JScript 5.5 supports an undefined value in compliance with ECMA edition 2. The associativity is from right to left. Refer to the operator precedence topic for details of execution order. This keyword also represents a Java data type and the void keyword allows for the potential extension of JavaScript interfaces to access Java applet parameters and return values. This technique is also useful if you want to evaluate an expression merely for the benefit of its side effects and without any interest in the value it returns.
Warnings: ❑
The void keyword is not available in Netscape version 2.02, or MSIE version 3.02 or earlier versions of either.
Example code: <SCRIPT> if(document.myUndefinedProperty == (void 0)) { document.write("An undefined property has been referenced"); } else { document.write("A defined property was used"); }
See also:
Assignment expression, Associativity, javascript: URL, LiveConnect, Operator, Operator Precedence, typeof, Unary expression, Unary operator, undefined
Cross-references: ECMA 262 edition 2 – section – 11.4.2 ECMA 262 edition 3 – section – 11.4.2 Wrox Instant JavaScript – page – 21
2377
Chapter number
void expression (Definition) An expression whose value is discarded and is evaluated purely for its side effects.
Example code: <SCRIPT> function clickMe(aString) { alert(aString); return "Some results to be ignored"; } Test
See also:
Constant expression, Conversion, Side effect
volatile (Reserved word) Reserved for future language enhancements. The addition of this operator suggests that volatile identifiers may be supported in a later version of the ECMAScript standard. See also:
const, Reserved word
Cross-references: ECMA 262 edition 2 – section – 7.4.3 ECMA 262 edition 3 – section – 7.5.3
2378
WAP (Standard) Wireless Application Protocol. This is a popular standard for use in mobile computing devices. It uses a derivative of the JavaScript standard language called WScript. This is constructed within a framework called WML, which is built around a structure organized like a stack of cards rather than pages, although the linkages between them are similar. At the time of writing, this standard has become somewhat popular but there is already talk of it only being a transitory system. Future mobile computing devices may use something more sophisticated and therefore WAP may become less popular. Ultimately it will be made obsolete by a new standard. See also:
Interpret, WML, WScript
watch() (Function/global) Set a watch-point for a named property of an object. Availability:
JavaScript - 1.2 Netscape - 4.0
JavaScript syntax:
N
myObject.watch(aProperty, aHandler)
aHandler
A handler that gets called when the property changes
aProperty
A property to watch
Argument list:
This method is provided to ease the task of debugging JavaScript. It provides a general purpose way to call an unconnected function when a property value is changed. The function does not need to be called explicitly. The function that gets called has a particular API, which passes the following values: ❑
Property name
❑
Old value
❑
New value
Error! No text of specified style in document.
It gets an opportunity to modify the new value or veto the change by returning the old value. Whatever value is returned is stored in the property. You can carry out other JavaScript tasks during this property call, although it is probably best to avoid making changes to other property values with watch-points that call the same handler, because you could set up a recursive loop. If you invoke the watch() method without specifying a receiving object, as if it were a function, you are actually setting watch-points on global object properties. Since this is where global variables live, you can monitor them as easily as object properties. The new event model supported by Netscape 6.0 and that already available in MSIE 5.0 present a propertyName property that belongs to the Event object. You can inspect that during an onPropertyChanged event and achieve the same watch()/unwatch() behavior.
Example code: <SCRIPT> // Code works with Netscape 4+ only // Define initial value for property var XXX = 10; // Define watch handler function function watchHandler(aProp, anOldVal, aNewVal) { var myText = ""; myText += "Property name ...: "; myText += aProp; myText += "\n"; myText += "Old value .......: "; myText += anOldVal; myText += "\n"; myText += "New value .......: "; myText += aNewVal; myText += "\n"; alert(myText); return aNewVal; } // Register the watch handler watch("XXX", watchHandler); Some body text <SCRIPT> // Modify the property to trigger the watch handler XXX = 1000;
See also:
Event, Event handler, Event management, Event model, Event object, onPropertyChange, unwatch(), Watchpoint handler
2381
Chapter number
Cross-references: Wrox Instant JavaScript – page - 56
Watchpoint handler (Interface) The handler that is connected to a watch point has a special pre-defined API specification. JavaScript syntax: Argument list:
-
function anId(aProp, oldVal, newVal) { someCode; return actualVal}
actualVal
The value that will be placed into the property
anId
A name for your handler function
aProp
A formal parameter to pass the property name in
newVal
A format parameter to pass the new value in
oldVal
A formal parameter to pass the old value in
Your handler function is passed to the watch() method belonging to the object whose property you want to monitor. When that property changes, your handler will be called. You will be passed the following: ❑
The property name
❑
The old value
❑
The new value
Whatever you return from this handler will be stored in the property and will become its new value. This means you can return the old value, forcing the property to be read-only. You might change the new value to something else. Perhaps you would force the value to be all uppercase regardless of how it had been specified. You may even want to display an alert to warn the operator that the property is being changed. See also:
watch()
Wave() (Filter/visual) A visual filter for creating ripple effects. Availability:
Refer to: filter - Wave()
2382
JScript - 3.0 Internet Explorer - 4.0
Error! No text of specified style in document.
.web (File extension) A compiled JavaScript and HTML application for Netscape Enterprise Server. File extensions, Netscape Enterprise Server
See also:
Web browser (Definition) A web browser can be used on a desktop computer, mobile device or TV set-top box to view web pages. When JavaScript is built into a web browser, the interpreter is an integral part of the application. However, it is technically possible to separate the JavaScript interpreter and provide it as a service that is available to all applications in the system. This seems to be the way that JScript is going on the Windows platform. Whether the browser-based script environment is truly sharing the Windows Script Host facilities may depend on the browser version being used. A web browser based interpreter will execute JavaScript that is provided in the following containers: ❑
An HTML page
❑
A JavaScript include (.js file)
❑
A Java archive (.jar file)
To add JavaScript to your HTML pages, you need to add <SCRIPT> tags as containers for the script source text. See also:
.jar, .java, .js, <SCRIPT>, Host environment, HTML, HTML file, iCab, Image object, Image(), Image.Class, Internet Explorer, Netscape Navigator, OpenTV, Opera, Platform, WebTV
Cross-references: Wrox Instant JavaScript – page - 5 Wrox Instant JavaScript – page - 41
Web scripting (Definition) Web browsers provide a host environment for client-side computation. Availability:
ECMAScript edition - 2
2383
Chapter number
Web browsers provide a host environment in which to view a web page downloaded from a remote server or from a local file system. Scripts running in that browser use an object model representation of the browser and the presently viewed document. These are called the Browser Object Model and the Document Object Model respectively. There are objects to represent windows, dialog boxes, alerts, text areas, anchors, frames and all the functionality that the browser provides through its graphical user interface. The host environment provides a means of connecting events to scripts and those scripts are then triggered when the user interacts with the document or browser. Because the entire complex provides a framework for execution and that execution is event driven, there is no main() function as you would have with the C language for example. JavaScript that executes in the browser is called client-side script code. Similar script code can be executed in the web server as part of the web page request-response loop. That code would generally be executed in a more serial fashion in response to a single event (generate a page). This sort of activity is called server-side scripting. A complete web-based application can be built with code distributed between the server and client environments.
Cross-references: ECMA 262 edition 2 – section - 4.1 ECMA 262 edition 3 – section - 4.1
Web server (Definition) An application that delivers web content on request from a browser. There are many web server products available. Here are a few: Server
Notes
Apache
At the time of writing it is currently at version 1.3.12 although minor updates happen all the time. The version 2.0 of Apache is now being seeded for beta testing.
Enterprise Server
A Netscape server product.
Fnord
A free web server that runs on Windows platforms
IIS
Internet Information Server. A Microsoft product
Intrabuilder
A Borland server product.
PWS
Personal Web Server. A Microsoft product
WebSite
A commercial PC-based web server.
WebStar
A Macintosh-based web server.
Cross-references: Wrox Instant JavaScript – page - 5
2384
Error! No text of specified style in document.
WebTV (TV Set-top Box) An analogue interactive TV set-top box. Set-top boxes fall into several categories. From the point of view of a JavaScript developer, the most important category is the 'Browser in a box' model. This takes a basic Netscape Navigator or MSIE browser, places it inside a modest functionality PC and allows its page content to be overlaid on top of the video that is broadcast off-air. The video can also be placed into a cell within the page to allow the web page to be placed behind the video. This is generally accomplished by allowing the tag to take its source from a new URL type. Instead of an HTTP: protocol, the TV: protocol is used to trigger the video overlay hardware in place of a web request. The WebTV boxes have been available for several years and are an analogue TV-set top box. The JellyScript interpreter used in the WebTV box underwent an upgrade in late Spring 2000 and was released for public use during the Summer. It is generally referred to as the Summer 2000 release. You should be somewhat careful with releases of interpreters in set-top boxes, as a new release is likely to be presented for each manufacturing run. These will generally contain only minor changes. The settop boxes are also designed to allow the interpreters to be upgraded remotely when they connect. This can lead to some interesting problems if you connect a UK PAL compatible box to an American NTSC service because the video hardware is reconfigured and is then rendered unusable. The integration of the web content with the TV service is by means of crossover links that are URL values embedded into the video signal on a very low data rate channel that is part of the closed captioning signal. The URL is encoded with a checksum and arrives at a rate of about 100 characters per second. Because the transfer is at such a low bit rate the URL values need to be short. When the box detects a cross-over link, it displays a small icon in the top right of the screen and the user can elect to request the associated page. The box then dials an ISP and the page is delivered in the normal way. This is a quite good and workable enhancement to the TV service and although its deployment is limited mainly to the United States, boxes have been trialled in Europe and elsewhere. There are a few limitations imposed on the JavaScript supported by the box and the embedded browser does not generally support extensions such as Java, plugins and ActiveX but nevertheless you can still accomplish quite a lot. See also:
ATVEF, Interpret, JellyScript, Microsoft TV, Platform, Script execution, TV Set-top boxes, Web browser
Cross-references: http://developer.webtv.net/authoring/javascript/javascript.htm
2385
Chapter number
Week day (Time calculation) A value between 0 and 6. Availability:
ECMAScript edition - 2
Property/method value type:
Number primitive
Calculating weekdays is a simple modulo and offset of the day number derived from the time value. The formula for calculating day number is shown here: t = an instant in time measured in milliseconds relative to 01-January-1970 UTC. msPerDay = 86400000 Day(t) = floor(t/msPerDay) WeekDay(t) = (Day(t) + 4) modulo 7 The resulting values will be from 0 to 6 with Sunday being represented by 0 and Saturday by 6. By way of proof, WeekDay(0) should yield 4 which represents Thursday, 01-January-1970.
Example code: // Grab the time now in milliseconds myMilliseconds = new Date().getTime(); document.write("Day number ...: "); document.write(DayNumber(myMilliseconds)); document.write("
"); document.write("Weekday number ...: "); document.write(WeekDayNumber(myMilliseconds)); document.write("
"); // Work out day number from milliseconds function DayNumber(aMillisecondTime) { msPerDay = 86400000 myDay = Math.floor(aMillisecondTime/msPerDay); return myDay; } // Work out the week day number based on a thursday start // This should be equivalent to Date.getDay(). function WeekDayNumber(aMillisecondTime) { return ((DayNumber(aMillisecondTime) + 4) % 7); }
See also:
2386
Day number, Time range
Error! No text of specified style in document.
Cross-references: ECMA 262 edition 2 – section - 15.9.1.6 ECMA 262 edition 3 – section - 15.9.1.6
Wheel() (Filter/transition) Reveals the new image with a rotating wheel effect. Availability:
JScript - 5.5 Internet Explorer - 5.5
Refer to: filter - Wheel()
while( ... ) ... (Iterator) An iterator mechanism – a loop construct. Availability:
JavaScript syntax: Argument list:
ECMAScript edition - 2 JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Netscape Enterprise Server version - 2.0 Opera - 3.0 while ( aCondition ) { someCode } aCondition
aLabel: while ( aCondition ) { someCode }
aLabel
An optional identifier name for the loop
someCode
The code that gets looped
If true, the loop cycles once more
Although the while() statement is an iterator, it is functionally related to the if() statement since it will execute the statement block only as long as the condition evaluates to true. The difference between if() and while() is that if() only processes the statement block once whereas while() processes the statement block repeatedly until something causes the condition enclosed in parentheses to evaluate to false. A while loop tests the condition before execution of each pass through the loop. If a do loop is supported by the implementations, it would test the condition after each pass through the loop. A break statement can be used to terminate a while() iterator prematurely, perhaps within a conditional test that is supplementary to the one in the while() heading.
2387
Chapter number
A continue statement can be used to initiate the next cycle of the while() iterator. The unlabeled form is more commonly used and was available from earlier releases of the JavaScript and JScript interpreters. Labeling was added later at version 1.2 but is not often used. If a labeled continue is used, the condition is tested again, and the loop will cycle if necessary.
Warnings: ❑
Make sure that something in the statement block will cause the test condition to change to false otherwise you will create an endless loop that can never exit. How this is dealt with depends on what you are doing in the loop and whether the implementation can detect an endless loop situation. It is likely the process containing the JavaScript interpreter will either stall and hang or a runtime error may result. In extreme cases, the hosting application may crash and on some platforms, the entire system may halt. At the very least, you could expect memory and CPU usage to go up while the loop runs. On a multi-user system, you may be able to use an administrator account to kill the offending process.
Example code: // An enumerator built with a while statement var a = 10; while(a>0) { document.write("*"); a--; } document.write("
"); // a labelled enumerator a=0; while(a10) { continue; } document.write("*
"); }
See also:
2388
break, Compound statement, continue, do ... while( ... ), Flow control, for( ... ) ..., for( ... in ... ) ..., if( ... ) ..., Iteration statement, Label, Obfuscation, Off by one errors
Error! No text of specified style in document.
Cross-references: ECMA 262 edition 2 – section - 12.6.1 ECMA 262 edition 2 – section - 12.7 ECMA 262 edition 2 – section - 12.8 ECMA 262 edition 3 – section - 12.6.2 Wrox Instant JavaScript – page - 23 Wrox Instant JavaScript – page - 25
Whitespace (Definition) Whitespace is used to separate tokens from one another. Availability:
ECMAScript edition - 2
Whitespace is used to improve the readability of the script and to separate tokens from one another where they could be misinterpreted if they were concatenated together. Whitespace characters are insignificant to the script execution apart from how they may affect the interpretation of tokens. The placement of whitespace can affect the way an expression is evaluated. For example: a = 10000; Will assign the value 10000 to the variable a, whereas: a = 10 000; May assign the value 10 to variable a but will likely generate a syntax error unless the interpreter is especially forgiving. Strictly speaking the interpreter should reject this: a = c ++; Is also incorrect since the postfix operator is dissociated from the variable it operates on by the whitespace in between. Actually, there are remarkably few places that whitespace cannot be introduced.
2389
Chapter number
The following characters are considered to be whitespace in ECMAScript conforming JavaScript interpreters: Escape Sequence
Unicode Value
Name
Symbol
\t \f -
\u0009 \u000B \u000C \u0020 \00A0 Other category "Zs"
Tab Vertical Tab Form Feed Space No-break space Other Unicode space characters
<SP>
ECMA edition 3 adds a couple of new whitespace character definitions. One is the non-breaking space and the other refers generally to Unicode spacing characters. See also:
Lexical convention, Lexical element
Cross-references: ECMA 262 edition 2 – section - 7.1 ECMA 262 edition 3 – section - 7.2 O'Reilly JavaScript Definitive Guide – page - 28
window (Property) The window object also known as window.window. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Property/method value type:
Window object
JavaScript syntax:
-
myWindow.window
-
window
See also:
Property attributes: ReadOnly.
2390
self, Window.frame, Window.window
Error! No text of specified style in document.
Window adornments (Definition) Another name for the furniture that surrounds a window.
Refer to: Window furniture
Window events (Definition) Some events within the event-handling complex relate to windows and their behaviors. These events are generally triggered by clicking on a window adornment or executing a method call on a window that simulates the effect of clicking on a window border item. See also:
onBack, onForward, onLoad, onMove, onResize, onScroll, onUnload
Window feature list (Definition) The list of available features that a window.open() method can apply. The feature list defines how the new window that is to be created will appear. For example, you can control the appearance of the various window adornments. The features are generally presented as a name-value pair, thus: name=value The features are either available for use as simple switches and will control the functionality depending on whether they are present or not. Some also support an optional value while others require a mandatory value. Features requiring a mandatory value are generally numeric in nature. The switching values may be "yes" or "1" to enable a feature and "no" or "0" to disable a feature. Switching features can be used with no associated value. This will generally default to "yes". As you would expect, MSIE and Netscape Navigator support a completely different and incompatible set of features. Even controlling the same attribute of the window may require different feature names to be used (for example width in MSIE and innerWidth/outerWidth in Netscape Navigator). The feature names are case insensitive but good style dictates that they are specified as shown in the table.
2391
Chapter number
Here is a summary of the available features of a window.open() method: Feature
Value
NNav
MSIE
Description
alwaysLowered
-
4
No
alwaysRaised
-
4
No
channelMode
-
No
4
dependent
Yes/No
4
No
directories
Yes/No
4
No
fullscreen
-
No
4
height hotkeys
Number Yes/No
2 4
4 No
innerHeight
Number
4
No
innerWidth
Number
4
No
left
Number
4
4
location menubar
Yes/No Yes/No
2 2
4 No
outerHeight
Number
4
No
outerWidth
Number
4
No
resizable
Yes/No
2
4
screenX screenY scrollbars
Number Number Yes/No
4 4 2
No No 4
status
Yes/No
2
4
toolbar
Yes/No
2
4
top
Number
4
4
width z-lock
Number -
2 4
4 No
This dictates that a window should always be at the bottom of the stack of windows. This dictates that a window should always be at the top of the stack of windows. Controls whether the window is presented in channel mode. If a window is not dependent, it can survive after its creator has been closed. Controls the appearance of the Netscape Navigator personal toolbar. On the Windows platform, MSIE will fill the screen with the window. This will set the window to the height value. Setting this value to "no" will disable most keyboard shortcuts apart from the quit option. This will set the window to the height value measured inside the window border. This will set the window to the width value measured inside the window border. The left edge of the window will be positioned N pixels from the left edge of the screen. The location bar is visible. The menubar is fully populated with menus and menu items. This will set the window to the height value measured outside the window border. This will set the window to the width value measured outside the window border. The window displays resize facilities according to the switch value. An alternative name for the left feature. An alternative name for the top feature. Scroll bars are explicitly displayed according to the switch value. The window displays a status bar according to the switch value. The window displays a toolbar according to the switch value. The top edge of the window will positioned N pixels from the top edge of the screen. This will set the window to the width value. This dictates that a window should always be at the same z-position in the stack of windows.
2392
Error! No text of specified style in document.
The following z-order feature switch values require the UniversalBrowserWrite privilege to be enabled when they are used in Netscape Navigator: ❑
alwaysLowered
❑
alwaysRaised
❑
hotKeys
❑
z-lock
Warnings: ❑
You must not include spaces in the feature list. If you do include spaces in the feature list attribute, the script may cause some versions of Netscape Navigator to crash horribly.
❑
Specifying a new window with a call to window.open() that has no arguments results in a window that is completely unadorned in MSIE and one that has a full complement of furniture (location, toolbar, etc.) in Netscape Navigator. Specifying even a single feature means the browser will assume all others are deactivated.
❑
For those features that require UniversalBrowserWrite privilege in Netscape Navigator, the time at which you request the feature may affect how the window is presented. This may be platform specific and Netscape Navigator may behave differently according to the UI rules and appearance of the hosting platform.
❑
In Netscape Navigator, on the Macintosh platform, setting the alwaysLowered feature will place a window at the bottom of the Z stacking order. That window will be permanently inactive as long as another window is open. It will be styled as a normal window. If the alwaysRaised feature is applied, the window will be placed on top and will be permanently active. In addition, the style is changed to that of a floating dialog (a Windoid in Macintosh UI parlance). A floating dialog in the Macintosh has a slimmer window border and a window title bar that is not as thick as a normal window.
❑
The fullscreen mode in the MSIE browser is not supported on the Macintosh platform.
❑
If you specify dimensions for the window, you must specify both the horizontal and vertical values otherwise Netscape Navigator will ignore the setting. MSIE will happily take only one of the values and provide a default for the other. Netscape Navigator requires both height and width but doesn't care what sort. You can mix innerHeight and outerWidth or height and innerWidth for example.
❑
Note that if the top or left values are specified on their own, the missing value will default to zero in both MSIE and Netscape Navigator.
❑
The scrollbars feature forces scroll bars to be present or not according its value in both browsers. However, scroll bars appear automatically if needed on MSIE even if the scrollbars feature is omitted. On Netscape Navigator, they will only be available if you explicitly ask for them. See also:
Window furniture, Window.open()
2393
Chapter number
Window furniture (Definition) The various controls and scrollbars on a window border. Sometimes called window adornments or chrome. The window furniture includes the following items: ❑
The location bar
❑
The active menu bar while the window is front-most
❑
The personal items bar
❑
Horizontal and vertical scrollbars
❑
The status bar at the bottom of the window
❑
The toolbar at the top of the window
These can all be controlled from scripts in Netscape Navigator. A script is always allowed to modify its own window with a call like this: open("", "_top", aFeatureList) It may require privileges to be enabled if it is going to alter another window (depending on the source of each window's documents). They can also be controlled in MSIE but only when a window is created with the window.open() method. See also:
Window feature list, Window.locationbar, Window.menubar, Window.personalbar, Window.scrollbars, Window.statusbar, Window.toolbar
Window object (Object/browser) An object representing a window or frame. This object exposes methods, properties, and events associated with it to the script. Availability:
JavaScript syntax:
2394
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0 myWindow = aFrameName -
myWindow = frames[anIndex]
-
myWindow = opener
-
myWindow = parent
-
myWindow = self
-
myWindow = top
-
myWindow = window
-
myWindow = window.open()
IE
myWindow = document.parentWindow
IE
myWindow = frame
Error! No text of specified style in document.
Argument list:
anIndex
An index to a window object
aFrameName Object properties:
Object methods:
Functions: Event handlers:
Collections:
The name of a frame in the window clientInformation, clipboardData, closed, crypto, defaultStatus, dialogArguments, dialogHeight, dialogLeft, dialogTop, dialogWidth, document, event, external, frame, frameRate, history, innerHeight, innerWidth, java, length, location, locationbar, Math, menubar, name, navigator, netscape, offScreenBuffering, opener, outerHeight, outerWidth, Packages, pageXOffset, pageYOffset, parent, personalbar, pkcs11, returnValue, screen, screenLeft, screenTop, screenX, screenY, scrollbars, secure, self, sidebar, status, statusbar, sun, toolbar, top, window alert(), attachEvent(), back(), blur(), clearInterval(), clearTimeout(), close(), confirm(), detachEvent(), disableExternalCapture(), enableExternalCapture(), execScript(), find(), focus(), forward(), home(), moveBy(), moveTo(), navigate(), open(), print(), prompt(), resizeBy(), resizeTo(), scroll(), scrollBy(), scrollTo(), setHotkeys(), setInterval(), setResizable(), setTimeout(), setZOptions(), showHelp(), showModalDialog(), showModelessDialog(), stop() atob(), btoa(), captureEvents(), handleEvent(), releaseEvents(), routeEvent() onAfterPrint, onBeforePrint, onBeforeUnload, onBlur, onDragDrop, onError, onFocus, onHelp, onLoad, onMouseMove, onMove, onResize, onScroll, onUnload frames[]
The window object was introduced when JavaScript was made available at version 1.0. It has been revised several times and is likely to gain new functionality with every release. This object is added to the scope chain as the global object when scripts are executed in a web browser. This means that the properties and methods are available without needing the window prefix. In a web browser this IS the global object. Adding properties (variables) during script execution adds them to the window object for the window in which the page containing the script is loaded. The window represents the browser container that the document object lives in. Since the on-screen window persists as long as the window is open, you might think it may be a useful place to store some session state data between documents. Clearly, storing session data in a document object is no use if the document is going to be discarded and replaced. However, anything created by a script belonging to a window is going to get zapped when the document goes away, so you cannot store persistent values in the window object like that because the global object for a web page is recreated each time a page is loaded. Storing session state data is best accomplished with a frame-set and some accessor scripts that are called within it. Event handling support via properties containing function objects was added to window objects in version 1.1 of JavaScript.
2395
Chapter number
Warnings: ❑
Be aware that if you store a reference to a window object and the window is closed, if you don't dispose of the reference to the window object then it cannot be garbage collected. A window object with no associated window is not much use unless you need to keep the object persistent due to having added some properties to it. If this is the case, then, arguably, the window object was the wrong place to put such things. See also:
BODY object, captureEvents(), Collection object, Document object, Document.activeElement, Document.captureEvents(), Document.frames[], Document.parentWindow, Document.releaseEvents(), EventCapturer object, Frame object, Frames object, Global object, IFRAME object, Layer.captureEvents(), Layer.releaseEvents(), Layer.window, self, Window.frame
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
client Information
-
3.0 +
-
4.0 +
-
-
-
Warning, ReadOnly, DontEnum.
clipboardData
-
5.0 +
-
5.0 +
-
-
-
-
closed
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
-
Warning, ReadOnly.
crypto
1.2 +
-
4.04 +
-
-
-
-
ReadOnly.
defaultStatus
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
dialog Arguments dialogHeight
-
3.0 +
-
4.0 +
-
-
-
ReadOnly.
-
3.0 +
-
4.0 +
-
-
-
-
dialogLeft
-
3.0 +
-
4.0 +
-
-
-
-
dialogTop
-
3.0 +
-
4.0 +
-
-
-
-
dialogWidth
-
3.0 +
-
4.0 +
-
-
-
-
document
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
1+
-
Warning, ReadOnly.
event
-
3.0 +
-
4.0 +
-
-
-
Warning, ReadOnly.
external
-
5.0 +
-
5.0 +
-
-
-
-
frame
-
5.0 +
-
5.0 +
-
-
-
Warning, ReadOnly.
frameRate
1.2 +
-
4.0 +
-
-
-
-
ReadOnly.
history
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
-
Warning, ReadOnly.
innerHeight
1.2 +
-
4.0 +
-
5.0 +
-
-
Warning
innerWidth
1.2 +
-
4.0 +
-
5.0 +
-
-
Warning
java
1.1 +
-
3.0 +
-
-
-
-
ReadOnly.
Table continued on following page
2396
Error! No text of specified style in document.
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
length
1.0 +
3.0 +
2.0 +
4.0 +
3.0 +
-
-
ReadOnly.
location
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning, ReadOnly.
locationbar
1.2 +
-
4.0 +
-
5.0 +
-
-
Warning, ReadOnly.
Math
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
menubar
1.2 +
-
4.0 +
-
-
-
-
Warning, ReadOnly.
name
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
1+
-
Warning
navigator
1.0 +
3.0 +
2.0 +
4.0 +
3.0 +
-
-
Warning, ReadOnly.
netscape
1.1 +
-
3.0 +
-
-
-
-
ReadOnly.
offScreen Buffering opener
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
-
Warning, ReadOnly.
outerHeight
1.2 +
-
4.0 +
-
5.0 +
-
-
Warning, ReadOnly.
outerWidth
1.2 +
-
4.0 +
-
5.0 +
-
-
Warning, ReadOnly.
Packages
1.1 +
-
3.0 +
-
3.0 +
-
-
ReadOnly.
pageXOffset
1.2 +
-
4.0 +
-
5.0 +
-
-
ReadOnly.
pageYOffset
1.2 +
-
4.0 +
-
5.0 +
-
-
ReadOnly.
parent
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning, ReadOnly.
personalbar
1.2 +
-
4.0 +
-
-
-
-
Warning, ReadOnly.
pkcs11
1.2 +
-
4.04 +
-
-
-
-
ReadOnly.
returnValue
-
3.0 +
-
4.0 +
-
-
-
Warning
screen
1.2 +
3.0 +
4.0 +
4.0 +
5.0 +
-
-
Warning, ReadOnly.
screenLeft
-
5.0 +
-
5.0 +
-
-
-
ReadOnly.
screenTop
-
5.0 +
-
5.0 +
-
-
-
ReadOnly.
screenX
1.2 +
-
4.0 +
-
-
-
-
-
screenY
1.2 +
-
4.0 +
-
-
-
-
-
scrollbars
1.2 +
-
4.0 +
-
-
-
-
Warning, ReadOnly.
secure
1.2 +
-
4.0 +
-
-
-
-
ReadOnly.
self
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
ReadOnly.
sidebar
1.5 +
-
6.0 +
-
-
-
-
-
Table continued on following page
2397
Chapter number
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
status
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
statusbar
1.2 +
-
4.0 +
-
-
-
-
Warning, ReadOnly.
sun
1.1 +
-
3.0 +
-
-
-
-
ReadOnly.
toolbar
1.2 +
-
4.0 +
-
-
-
-
Warning, ReadOnly.
top
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning, ReadOnly.
window
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning, ReadOnly.
Method
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
alert()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
attachEvent()
-
5.0 +
-
5.0 +
-
-
-
Warning
back()
1.2 +
-
4.0 +
-
-
-
-
Warning
blur()
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
1+
-
Warning
clear Interval() clear Timeout() close()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
confirm()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
-
detachEvent()
-
5.0 +
-
5.0 +
-
-
-
-
disable External Capture() enable External Capture() execScript()
1.2 +
-
4.0 +
-
-
-
-
Warning
1.2 +
-
4.0 +
-
-
-
-
Warning
-
3.0 +
-
4.0 +
-
-
-
-
find()
1.2 +
-
4.0 +
-
-
-
-
-
focus()
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
-
Warning
forward()
1.2 +
-
4.0 +
-
-
-
-
Warning
home()
1.2 +
-
4.0 +
-
-
-
-
-
moveBy()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
moveTo()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
navigate()
-
1.0 +
-
3.02 +
-
-
-
Warning
open()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
print()
1.2 +
5.0 +
4.0 +
5.0 +
-
-
-
Warning
prompt()
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
resizeBy()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
2398
Error! No text of specified style in document.
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
resizeTo()
1.2 +
3.0 +
4.0 +
scroll()
1.1 +
3.0 +
3.0 +
4.0 +
-
-
-
Warning
4.0 +
3.0 +
-
-
Warning, Deprecated
scrollBy()
1.2 +
3.0 +
scrollTo()
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
4.0 +
4.0 +
-
-
-
setHotkeys()
Warning
1.2 +
-
setInterval()
1.2 +
3.0 +
4.0 +
-
-
-
-
Warning
4.0 +
4.0 +
-
-
-
Warning
Set Resizable() setTimeout()
1.2 +
-
4.0 +
-
-
-
-
Warning
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
setZOptions() showHelp()
1.2 +
-
4.0 +
-
-
-
-
Warning
-
3.0 +
-
4.0 +
-
-
-
Warning
showModal Dialog() showModeless Dialog() stop()
-
3.0 +
-
4.0 +
-
-
-
Warning
-
5.0 +
-
5.0 +
-
-
-
-
1.2 +
-
4.0 +
-
-
-
-
Warning
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onAfterPrint
-
5.0 +
-
5.0 +
-
-
-
-
onBeforePrint
-
5.0 +
-
5.0 +
-
-
-
-
onBefore Unload onBlur
-
3.0 +
-
4.0 +
-
-
-
-
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
-
Warning
onDragDrop
1.2 +
-
4.0 +
-
-
-
-
-
onError
1.1 +
3.0 +
3.0 +
4.0 +
3.0 +
-
-
Warning
onFocus
1.0 +
3.0 +
2.0 +
4.0 +
3.0 +
-
-
Warning
onHelp
-
3.0 +
-
4.0 +
-
-
-
Warning
onLoad
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
onMouseMove
1.2 +
3.0 +
4.0 +
4.0 +
-
-
4.0 +
Warning
onMove
1.2 +
-
4.0 +
-
-
-
-
-
onResize
1.2 +
3.0 +
4.0 +
4.0 +
-
-
-
Warning
onScroll
-
3.0 +
-
4.0 +
-
-
-
-
onUnload
1.0 +
1.0 +
2.0 +
3.02 +
3.0 +
-
-
Warning
2399
Chapter number
Window.alert() (Method) Present an alerting dialog box. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Property/method value type:
undefined
JavaScript syntax:
-
alert(aString)
-
myWindow.alert(aString)
aString
Some text to display in the alert box
Argument list:
This presents a dialog containing the warning message and an OK button. Note that the text that is presented in the dialog is unformatted text and you cannot use HTML in the dialog box. The title bar of the dialog box cannot be changed from its default setting that tells you that the dialog was invoked by JavaScript. In some browsers, it may just display the name of the browser. This is intended to stop script programmers from masquerading their dialog boxes as those of operating system diagnostics and login screens. The alert() dialog box is modal on most platforms. It also blocks the script from continuing except on some versions of Netscape Navigator on Unix platforms. This behavior may become more common as desktop operating systems become more Unix-like and the Netscape Navigator core source code is deployed on newer operating systems. It is possible that this behavior will be exhibited on Mac OS X. This method is useful for debugging. You can use it much like you would have used a printf() in C language debugging. Using alert() can sometimes be useful as an observable effect of calling a function or event handler. If you don't see the alert box, it’s likely the event didn't call your handler. You may be able to accomplish some rudimentary formatting but realistically due to font differences on platforms the only meaningful formatting is to place newline characters (\n) into the text to introduce a line break and to insert leading spaces for indentation. This method does not return any meaningful value and if it is used in an assignment, the value undefined will be used.
2400
Error! No text of specified style in document.
Warnings: ❑
Be aware that the dialog may be modal but that the script may or may not continue while the alert() dialog is displayed. It depends on the platform. On Windows, the script execution pauses until the OK button is clicked. On UNIX, the alert is displayed by a different process or thread and the script execution continues. If you need truly modal behavior you should consider the confirm() or prompt() dialogs instead. See also:
Debugging - client-side, Dialog boxes, Dialog object, Frame object, Window object, Window.confirm(), Window.prompt()
Cross-references: Wrox Instant JavaScript – page - 78
Window.atob() (Function) Decode some base-64 encoded data. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
String primitive
JavaScript syntax:
N
atob(aBase64String)
N
myWindow.atob(aBase64String)
aBase64String
A string containing base-64 encoded data
Argument list:
This function provides a means of decoding base-64 encoded values which represent an encoded form of some binary data. This encoding can be applied to text too, but is most useful where you have a block of non-textual content. The base-64 data is decoded and converted to a block of binary data. This is then stored in a string primitive and returned to the caller as the result of the method. To extract the binary data from the string, you will need to parse the string a character at a time and extract the numeric character value with the String.charCodeAt() method. You can modify the binary data directly by storing numeric values at each character position. Note that the string will contain a sequence of 8-bit bytes and so you will need to be careful to range-limit any values that you store in the binary string. The result is a block of binary data in a string primitive. This is somewhat cumbersome and not likely to be much used outside of a mail-reading client. See also:
String.charAt(), String.charCodeAt(), String.fromCharCode(), Window.btoa()
2401
Chapter number
Window.attachEvent() (Method) A means of attaching events to windows and documents. Availability:
JScript - 5.0 Internet Explorer - 5.0
Property/method value type:
Boolean primitive
JavaScript syntax:
IE IE
Argument list:
attachEvent(anEventName, anEventHandler) myWindow.attachEvent (anEventName, anEventHandler)
anEventHandler
A reference to an event handler function
anEventName
The name of an event to be handled
This is part of the behavior handling in MSIE which involves the use of style sheets and .htc files. It is a way of binding a function to an event so that when the event fires, the function is called. It can be applied in a more general way than just with behaviors. The mechanism is quite straightforward to apply. First, create a style that can be used to attach the script to an HTML element. In that style, refer to a fragment of JavaScript contained in an external file. That external file is called an HTML Component or HTC. It is stored in an .htc file. The .htc file is invoked in a similar way to the <SCRIPT SRC="..."> mechanism. Then, in that .htc file, you create a handler script that attaches itself to whatever event you want the handler to be connected to. This attachEvent() method is what is used to accomplish that. When the browser loads the page, the .htc file is loaded and installed and the script registers itself with the event trapping mechanisms in the browser. When the event fires, the handler script in the HTML component is executed. There are many advantages regarding code re-use and efficiency that this technique facilitates. However, the downside is that the HTML components can result in a large number of additional requests for separate items from the web server and this can be detrimental to performance. So detrimental, in fact, that it is possible that the items may not all be loaded by the time the user is ready to interact with the page. Two events are triggered which can be used to manage this scenario more elegantly. These are the onContentReady and onDocumentReady events. They are sent to the behavior script as a notification so you can take some action internally to prime your handler. These events would typically cause the behavior handler to set flags internally that can be checked when the handler is invoked by the user. Those flags can then lock out any interaction with the page until it is known that the content of the element and the rest of the document have been loaded. At the very least, the handler should wait until the first receipt of an onContentReady event.
Warnings: ❑
This functionality is unavailable on the Macintosh version of the MSIE browser up to at least version 5. See also:
2402
<STYLE>, Document.attachEvent(), Document.detachEvent(), Window.detachEvent()
Error! No text of specified style in document.
Window.back() (Method) A method that mimics the user clicking on the back button. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
undefined
JavaScript syntax:
N
back()
N
myWindow.back()
The browser will behave as if the user had clicked on the back button at the top of the window.
Warnings: ❑
If this is executed in a contained window, the behavior of the Window.back() method may not always be consistent with the History.back() method. One may simply affect the frame while the other may affect the entire browser window at the top of the frame-set hierarchy. See also:
Frame object, History.back(), Window object, Window.forward()
Window.blur() (Method) Send a blur event to the window object. Availability:
DOM level - 1 JavaScript - 1.1 JScript - 3.0 Internet Explorer - 4.0 Netscape - 3.0 Opera - 3.0
Property/method value type:
undefined
JavaScript syntax:
-
blur()
-
myWindow.blur()
This will take the input focus away from the receiving window, usually the one at the top of the window hierarchy. On some platforms, this will also make the window inactive and may put it to the back of the window hierarchy. There are good arguments for using the focus() method on another window rather than the blur() method. Removing focus from a window should make it safe from inadvertent mouse clicks at the expense of making the window inactive altogether, which could be frustrating for the user.
2403
Chapter number
Warnings: ❑
This method is not supported by MSIE version 3.
❑
It is possible that a window may become inactive with this method and since no window has focus you could have an active application with no active window. This is a fairly sloppy way of providing a UI interaction. A better technique is to use the focus() method to redirect the focus to the desired window which, by implication, blurs() any other that may previously have had the focus. This should result in a more consistent behavior for the user. See also:
Frame object, Input.blur(), Input.focus(), Window object, Window.focus(), Window.onblur, Window.onfocus
Window.btoa() (Function) Encode some data into base-64 form. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
String primitive
JavaScript syntax:
N
btoa(aBinaryString)
N
myWindow.btoa(aBinaryString)
aBinaryString
A string of binary data to be encoded
Argument list:
This function will encode the string passed as an argument and return a base-64 encoded version. Base-64 encoding is used to convert binary data into a form that survives transmission across a network, so the data passed in its input argument is really binary data. It is carried in a string value because JavaScript doesn't support a special binary container. However, JavaScript strings will happily accept 8 bit values and you can therefore store binary data in them. You would normally create the string of binary data by means of the String.fromCharCode() static method. The result is a string of binary data escaped in such a way that it will survive a serial transfer through an "old-fashioned" connection. Network drivers and serial interfacing technology make this technique largely redundant and there can be few genuine applications for this other than to decode information from legacy systems or to interface to them somehow from a web browser. The functionality has very limited portability and will likely be deprecated at some stage in the future. See also:
String.fromCharCode(), Window.atob()
Window.captureEvents() (Function) Part of the Netscape Navigator event propagation complex. Availability:
JavaScript - 1.2 Netscape - 4.0
Deprecated:
JavaScript - 1.5 Netscape - 6.0
2404
Error! No text of specified style in document.
Property/method value type: JavaScript syntax: Argument list:
undefined N
captureEvents(anEventMask)
N anEventMask
myWindow.captureEvents(anEventMask) A mask constructed with the manifest event constants
This is part of the event management suite which allow events to be routed to handlers other than just the one that defaults to being associated with an event. The events to be captured are signified by setting bits in a mask. This method allows you to specify what events are to be routed to the receiving window object. The events are specified by using the bitwise OR operator to combine the required event mask constants into a mask that defines the events you want to capture. Refer to the Event Type Constants topic for a list of the event mask values. A limitation of this technique is that, ultimately, only 32 different kinds of events can be combined in this way and this may limit the number of events the browser can support. If you need to build complex event handling systems in Netscape Navigator 4.x, you will have implement scripts using this technique. A different script will be required for MSIE. You may be able to factor your event handler so that you only have to make platform specific event dispatchers and can call common handling routines that can be shared between MSIE and Netscape. This method is supported by virtually every object by virtue of the fact that it is available as a method of the Global object in Netscape Navigator. Therefore it gets inherited into the scope chain for every script and function (method).
Warnings: ❑
Since a bit mask is being used, this must be an int32 value. This suggests that there can only be 32 different event types supported by this event propagation model.
❑
This capability is deprecated and is not supported in Netscape 6.0 . It has never been supported by MSIE which implements a completely different event model. As it turns out, the DOM level 2 event model converges on the MSIE technique.
Example code: // Build and setup a mask for several events myEventMask = Event.KEYDOWN | Event.MOUSEDOWN | Event.RESET; window.captureEvents(myEventMask); function EventHandler(anEventObject){//... some event handling code here} window.onkeydown = EventHandler; window.onmousedown = EventHandler; window.onreset = EventHandler;
See also:
captureEvents(), Document.captureEvents(), Element.onevent, Event propagation, Event type constants, Frame object, Layer.captureEvents(), onMouseMove, Window object, Window.releaseEvents()
2405
Chapter number
Window.clearInterval() (Method) Cancel a previous setInterval() timer that caused a function to be called periodically. Availability:
JavaScript - 1.2 JScript - 3.0 Internet Explorer - 4.0 Netscape - 4.0
Property/method value type:
undefined
JavaScript syntax:
-
clearInterval(anIntervalID)
-
myWindow.clearInterval(anIntervalI D)
anIntervalID
The ID of an interval returned by the setInterval() method
Argument list:
The interval timer mechanism can be used to repeat the execution of a block of script code at regular intervals. You can establish several blocks of repeating code at once if necessary, so there could be a number of pending interval timers. You must be able to identify the one that you want to clear. When you create an interval timer with the setInterval() method, it will return back to you with a value that corresponds uniquely to that interval's set-up context. You can use that value later to clear the interval timer. You must be careful not to clear an interval more than once.
Warnings: ❑
Be careful when clearing interval timers. If you try to clear one that does not exist, it can sometimes crash the browser. See also:
Frame object, Interval handlers, Timeout handlers, Timer events, Window object, Window.clearTimeout(), Window.setInterval(), Window.setTimeout()
Window.clearTimeout() (Method) Clear a previously established timeout function call. Availability:
2406
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Error! No text of specified style in document.
Property/method value type:
undefined
JavaScript syntax:
-
clearTimeout(aTimeoutID)
-
myWindow.clearTimeout(aTimeoutID)
aTimeoutID
The ID of a timeout returned by the setTimeout() method
Argument list:
The timeout mechanism can be used to defer the execution of a block of script code. You can defer several blocks at once if necessary, so there could be a number of pending timeout triggers. You must be able to identify the one that you want to clear. When you create a timeout trigger with the setTimeout() method, it will return back to you with a value that corresponds uniquely to that trigger's set-up context. You can use that value later to clear the timeout trigger. You must be careful not to clear timeout triggers more than once.
Warnings: ❑
Be careful when clearing interval timers. If you try to clear one that does not exist, it can sometimes crash the browser.
❑
It is highly likely that the interval may have elapsed and the timeout no longer exists to be cleared. A more reliable technique that is less prone to browser crashes is to set a flag value in a global variable and then test that from within the timeout invoked function. See also:
clearTimeout(), Frame object, Timeout handlers, Timer events, Window object, Window.clearInterval(), Window.setTimeout()
Window.clientInformation (Property) This is another more appropriate name for the navigator object. Availability:
JScript - 3.0 Internet Explorer - 4.0
Property/method value type:
Navigator object
JavaScript syntax:
IE
clientInformation
IE
myWindow.clientInformation
This is an alternative name for the window.navigator property.
Warnings: ❑
Note that the clientInformation reference is another name for the navigator object. We could be uncharitable and suggest that this is an attempt by Microsoft to avoid publicising a competitor's browser name in any scripts that they publish. It is likely that scripts written by and for Microsoft products would use this syntax rather than the navigator property, and will break on Netscape Navigator.
2407
Chapter number
See also:
Frame object, Window object, Window.navigator
Property attributes: ReadOnly, DontEnum.
Window.clipboardData (Property) An object containing data that represents the contents of the clipboard. Availability: Property/method value type: JavaScript syntax:
JScript - 5.0 Internet Explorer - 5.0 clipboardData object IE
clipboardData
IE
myWindow.clipboardData
If you want to move data in and out of the clipboard on a Windows platform from within the MSIE browser, this property will yield a reference to a clipboardData object that encapsulates the clipboard contents.
Example code: // Example of how to use the clipboard object supplied by // Martin Honnen. clipboardData.setData('Text', 'All for Kibology'); alert(clipboardData.getData('Text')); clipboardData.clearData(); alert(clipboardData.getData('Text'));
See also:
clipboardData object
Window.close() (Method) This will close the window. Availability:
Property/method value type: JavaScript syntax:
2408
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0 undefined -
close()
-
myWindow.close()
Error! No text of specified style in document.
The method window.close() will attempt to close the window in which the script is executing. This is only possible without a user confirmation dialog if the script has the UniversalBrowserWrite privilege. The statement self.close() is effectively window.close() and will also attempt to close the window in which the script is executing. A JavaScript running inside a window may close that window. JavaScripts running outside a window may or may not be able to close that window. This may be implementation dependent and may also depend on the value of the opener property of the target window and the current security policy in force. Attempts to close windows that your JavaScript did not open will elicit a user dialog to get permission to close the window. This is so that people cannot write invasive scripts that wreak havoc on your browser session when they are loaded. The default behavior is to allow JavaScript to close windows which were opened by scripts that were originally served from the same server and which were not opened by the user. This may be overridden if additional privileges are granted to scripts. From version 1.1 of JavaScript, (generally speaking) you can only close windows that were opened by JavaScript from within a script. Although, certain browser privileges will allow you to close other windows and this behavior may be browser dependent.
Warnings: ❑
Do not confuse this method with the document.close() method. They are not the same.
❑
Do not call this for Window objects that represent frames, you cannot close a single frame within a window. See also:
Frame object, Frame.close(), UniversalBrowserAccess, UniversalBrowserWrite, Window object, Window.open(), Window.opener
Window.closed (Property) A property value that is true if the window is closed. Availability:
JavaScript - 1.1 JScript - 3.0 Internet Explorer - 4.0 Netscape - 3.0 Opera - 3.0
Property/method value type:
Boolean primitive
JavaScript syntax:
-
closed
-
myWindow.closed
2409
Chapter number
From JavaScript version 1.1 onwards, a window object may persist after it has been closed. This may seem odd but it is possible that the window object will have had other object references added to it and for it to be deleted, it must relinquish those references. Without this object persistence, a dangerous cascading delete effect may happen, inadvertently discarding all manner of objects within your script context. The only valid thing you should access at this point is the closed property. This allows you to check for the window having been closed by the user before you try to do something with it. Some programmers would argue that this is poor technique anyway and that a reference to a window held externally should be nulled by the closing function. That way you can test a variable that exists within the script's scope chain rather than an object that should probably have been purged from memory. Given the bugs in the implementation of this feature, that is a better way to determine whether a window is still in existence.
Warnings: ❑
This value can be read by an unsigned script in another window. However, Netscape Navigator (at least on the Macintosh platform) exhibits some bugs with this whole mechanism and the property value is of limited use in any case.
❑
For a start, you cannot access the closed property of the object that the Window.open() method returns because it is an EventCapturer object and not a window object. You can contrive to store a reference to the new window in the original window's properties by making it pass a reference to its window.self property which needs to be stored in a property belonging to its window.opener. However, if the child window is then closed, the object that refers to it becomes void and there is no access to any of its properties, let alone its window.closed property.
❑
There are sufficient problems in this area that without some quite tricky scripting you cannot make use of this facility in a portable manner. See also:
Frame object, Window object
Property attributes: ReadOnly.
Window.confirm() (Method) Present a confirmation dialog box. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Property/method value type:
Boolean primitive
2410
Error! No text of specified style in document.
JavaScript syntax: Argument list:
-
myResult = confirm(aString)
-
myResult = myWindow.confirm(aString)
aString
Some text to explain what is to be confirmed
This presents a modal dialog containing the confirmation message and two buttons, OK and Cancel. This is useful because you often need confirmation from a user. This method is useful for debugging. An example showing how it can be used for debugging a recursive function is given below. Note that the text that is presented in the dialog is plain unformatted text and you cannot use HTML text in the dialog box. The title bar of the dialog box cannot be changed from its default setting which tells you that the dialog was invoked by JavaScript. In some browsers, it may just display the name of the browser. This is intended to stop script programmers from masquerading their dialog boxes as those of operating system diagnostics and login screens. The confirm() dialog box is modal and blocking. The script must wait for a response from the user. When the user clicks on either of the buttons, the result returned by the method indicates which one was chosen. The true value indicates the OK button was clicked and false indicates the Cancel button.
Example code: // Example showing the use of a confirm() dialog to // debug recursive calls provided by Martin Honnen. function showTime() { if (confirm('Time is: ' + new Date() + '. Show again?')) { setTimeout('showTime()', 1000 * 5); } } showTime();
See also:
Debugging - client-side, Dialog boxes, Dialog object, Frame object, Window object, Window.alert(), Window.prompt()
Cross-references: Wrox Instant JavaScript – page - 78
2411
Chapter number
Window.crypto (Property) A reference to a Crypto object for security encoding. Availability:
JavaScript - 1.2 Netscape - 4.04
Property/method value type:
Crypto object
JavaScript syntax:
N
crypto
N
myWindow.crypto
The object referred to by this property is used with the browser security model. Refer to the topic that discusses the Crypto object for more details. See also:
Crypto object
Property attributes: ReadOnly.
Window.defaultStatus (Property) A property containing the text displayed in the status bar. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Property/method value type:
String primitive
JavaScript syntax:
-
defaultStatus
-
defaultStatus = aString
-
myWindow.defaultStatus
-
myWindow.defaultStatus = aString
aString
A new value for the default status
Argument list:
As the mouse rolls over active elements in the page, they may write values into the status bar. This is the value that is restored when the mouse rolls out of the object. Although this is called the defaultStatus value, you can change its setting by writing a new value into the property. A useful technique is to reset this value to an empty string using a or onUnload handler.
2412
Error! No text of specified style in document.
As an example of a way to use this property, it may be useful to give the user some helpful message when loading a into the window. You can read or write the value in this property. Because this also works with frames, you can set the value for this to be different according to the frame that the mouse is over. That way, the message can give the user some context sensitive hints on a frame by frame basis. You need to be careful about this because if you define the defaultStatus value in a top level window that contains frames, when the mouse is in the frames, the defaultStatus value will be that which is defined for the frame and not the window. The window's default status will only be displayed when the mouse is over the border in between the frames, hence you must define the defaultStatus value for all frames as well as the window. If you only need to display a temporary message, then use the status property instead of the defaultStatus property.
Warnings: ❑
The default status value may not be properly restored on some platforms. Macintosh and X-Windows versions of Netscape 3 may exhibit this problem as may other browser and platform combinations. See also:
Frame object, onMouseOut, onMouseOver, Status line, Window object, Window.status
Window.detachEvent() (Method) A means of detaching events from windows and documents that were previously attached with the attachEvent() method. Availability: JavaScript syntax: Argument list:
JScript - 5.0 Internet Explorer - 5.0 detachEvent(anEventName) IE IE anEventName
myWindow.detachEvent(anEventName) The name of an event to be handled
This is part of the behavior handling in MSIE which involves the use of style sheets and .htc files. See also:
<STYLE>, Document.attachEvent(), Document.detachEvent(), Window.attachEvent()
2413
Chapter number
Window.dialogArguments (Property) The arguments passed to a model dialog in a showModalDialog() call. Availability:
JScript - 3.0 Internet Explorer - 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
dialogArguments
IE
myWindow.dialogArguments
This is only available when the window is contained within a modal dialog. It is the value contained in the second argument of the showModalDialog() method. You can use this to pass values into the modal dialog and the returnValue property of the window object inside the modal dialog to return a value to the caller. Refer to the Window.showModalDialog() topic for an example of how this works. See also:
Window.showModalDialog()
Property attributes: ReadOnly.
Window.dialogHeight (Property) The height of a modal or modeless dialog window. Availability:
JScript - 3.0 Internet Explorer - 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
dialogHeight
IE
myWindow.dialogHeight
Dialog windows are a special kind of window supported by MSIE, principally to provide a more sophisticated alternative to an alert(), confirm() or prompt() dialog. This property yields the height of such a dialog window which can be changed by assigning a value to this property from a script running in the window. The value returned will be a value and a measurement unit in the same style as would be used with a CSS positioning style property. This means it will be a string and not a numeric value and will need to be parsed carefully.
2414
Error! No text of specified style in document.
Window.dialogLeft (Property) The left edge of a modal or modeless dialog window. Availability:
JScript - 3.0 Internet Explorer - 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
dialogLeft
IE
myWindow.dialogLeft
Dialog windows are a special kind of window supported by MSIE, principally to provide a more sophisticated alternative to an alert(), confirm() or prompt() dialog. This property yields the position of the left edge of such a dialog window which can be changed by assigning a value to this property from a script running in the window. The value returned will be a value and a measurement unit in the same style as would be used with a CSS positioning style property. This means it will be a string and not a numeric value and will need to be parsed carefully.
Window.dialogTop (Property) The top edge of a modal or modeless dialog window. Availability:
JScript - 3.0 Internet Explorer - 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
dialogTop
IE
myWindow.dialogTop
Dialog windows are a special kind of window supported by MSIE, principally to provide a more sophisticated alternative to an alert(), confirm() or prompt() dialog. This property yields the position of the top edge of such a dialog window which can be changed by assigning a value to this property from a script running in the window. The value returned will be a value and a measurement unit in the same style as would be used with a CSS positioning style property. This means it will be a string and not a numeric value and will need to be parsed carefully.
2415
Chapter number
Window.dialogWidth (Property) The width of a modal or modeless dialog window. Availability:
JScript - 3.0 Internet Explorer - 4.0
Property/method value type:
String primitive
JavaScript syntax:
IE
dialogWidth
IE
myWindow.dialogWidth
Dialog windows are a special kind of window supported by MSIE, principally to provide a more sophisticated alternative to an alert(), confirm() or prompt() dialog. This property yields the width of such a dialog window which can be changed by assigning a value to this property from a script running in the window. The value returned will be a value and a measurement unit in the same style as would be used with a CSS positioning style property. This means it will be a string and not a numeric value and will need to be parsed carefully.
Window.disableExternalCapture() (Method) Part of the Netscape Navigator 4 event propagation complex. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
undefined
JavaScript syntax:
N
disableExternalCapture()
N
myWindow.disableExternalCapture()
This method allows you to inhibit the receipt of events from other window objects that might have been loaded from a server other than the one that provided the script it is called from. You need higher than normal privilege to execute this method. However this method itself is quite harmless, the one that really requires the security interlocking is the window.enableExternalCapture() method.
Warnings: ❑
Although this method can be called without any special privilege being necessary, your script will need to be granted the UniversalBrowserWrite privilege to enable the external capture again. See also:
2416
Frame object, UniversalBrowserWrite, Window object, Window.enableExternalCapture()
Error! No text of specified style in document.
Window.document (Property) A reference to the document object that is contained in the window. Availability:
DOM level - 1 JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Property/method value type:
Document object
JavaScript syntax:
-
document
-
myWindow.document
This property returns a reference to an object that represents the document that is currently loaded into the window.
Warnings: ❑
Beware of recursion effects by referring to the document belonging to the window and then referring back unintentionally via a property enumeration. The document.parentWindow property in MSIE will come straight back to the source window.
❑
Beware that this refers to an object that belongs to the window and not the object that the window belongs to. See also:
Document object, Document.parentWindow, Element.document, Frame object, Window object
Property attributes: ReadOnly.
Cross-references: Wrox Instant JavaScript – page - 80
Window.enableExternalCapture() (Method) Part of the Netscape Navigator 4 event propagation complex. Availability: Property/method value type: JavaScript syntax:
JavaScript - 1.2 Netscape - 4.0 undefined -
enableExternalCapture()
-
myWindow.enableExternalCapture()
2417
Chapter number
This method allows you to begin capturing events from other window objects that might have been loaded from a server other than the one that provided the script it is called from. This is not usually permitted because you could build a script that watches for users typing a password, for example. You need higher than normal privileges to execute this method.
Warnings: ❑
This method requires your script to be granted the UniversalBrowserWrite privilege to operate properly in Netscape Navigator. See also:
disableExternalCapture(), Frame object, UniversalBrowserWrite, Window object, Window.disableExternalCapture()
Window.event (Property) During event handling, MSIE stores a reference to an event object in this variable. Availability: Property/method value type: JavaScript syntax:
JScript - 3.0 Internet Explorer - 4.0 Event object IE
event
IE
myWindow.event
In MSIE, this property yields a reference to an event object. This only has any meaning during an event handler call and it is shared by all events which you would assume will cause some problems when multiple events are triggered. However, it seems to sort itself out most of the time. You will most likely refer to the event property as a member of the Global object, omitting the window prefix. The handler can acquire the object if it needs it to find out more about the context of the event. In Netscape Navigator prior to version 6.0, the event object is passed as an argument to the event handler function. Netscape 6.0 implements the DOM level 2 event model which works like the MSIE technique. This means your event handlers must be written slightly differently if they need to access an event object that pertains to the event itself. To get a roughly portable handler together, the MSIE event can be stored in a local variable. Then, as it turns out, it is easier to convert the old style Netscape Navigator properties to MSIE compatible properties. You may not need to convert all of them and you may need to do some experimentation to see that the bit-masking of modifier keys is correctly set up for your target browser. The Closure() object technique applies here when assigning function objects to be event handlers although that is not supported by MSIE version 4. This entire event managing complex is under review and some work on standardization happens at DOM level 2 with more to come in DOM level 3. We may have to experience several more browser revisions before we can rely on a truly portable approach and that won't solve legacy browser issues until everyone has upgraded.
2418
Error! No text of specified style in document.
Warnings: ❑
The MSIE event-handling model is radically different to the Netscape Navigator event-handling model. Unless you are doing only very simple event handling you will likely need to code for both models and somehow make them both available in the same page.
Property attributes: ReadOnly.
Window.execScript() (Method) Execute a script on behalf of a window. Availability: Property/method value type: JavaScript syntax:
Argument list:
JScript - 3.0 Internet Explorer - 4.0 User defined IE
execScript(aSourceText)
IE
execScript(aSourceText, aLanguage)
IE
myWindow.execScript(aSourceText)
IE
myWindow.execScript(aSourceText, aLanguage)
aSourceText
Some legal script source text
aLanguage
The language to execute the script source in
This is somewhat like an eval() call except that the script runs in the context and scope chain of the target window and not the window whose script makes the call. Because this is currently only supported in MSIE, you may not find it very useful. See also:
Frame object, Window object
Window.external (Property) Reference to an external object outside of the interpreter. Availability:
JScript - 5.0 Internet Explorer - 5.0
Property/method value type:
External object
JavaScript syntax:
IE
external
IE
myWindow.external
The MSIE browser supports a means of access to the surrounding object space that contains the browser and the desktop environment in which it executes. This of course is only available on the Windows platform and its use is discouraged for reasons of portability. See also:
external
2419
Chapter number
Window.find() (Method) This duplicates the behavior of the FIND button on the Netscape Navigator button bar. Availability:
JavaScript - 1.2 Netscape - 4.0
Deprecated:
Netscape - 6.0
Property/method value type:
Boolean primitive
JavaScript syntax:
-
find()
-
find(aSearchKey)
-
find(aSearchKey, aCaseSense)
-
find(aSearchKey, aCaseSense, aDirection) myWindow.find()
-
myWindow.find(aSearchKey)
-
myWindow.find(aSearchKey, aCaseSense)
-
myWindow.find(aSearchKey, aCaseSense, aDirection)
aCaseSense
A switch for case sensitivity
aDirection
A direction to search
aSearchKey
The text to search for
Argument list:
All of the arguments are optional. However, you must specify the first argument if want to specify the second and so on. If no arguments are specified, a dialog box is presented to the user for them to specify the search attributes. The search key is a arbitrary string of characters. The search facility will look for this string in the current page. The case sensitive switch parameter must be true to force a case sensitive search and false to ignore case. By default a case insensitive search is carried out if this argument is omitted. The direction switch is a true for a backwards search and false for a forwards search. The default is a forwards search if this argument is omitted. Forward searches commence at the current cursor position or immediately after the current selection if there is one, see position A on figure overleaf. If there is no selection or the cursor has not been focussed into the page and positioned there, then the search begins at the top of the document, see position C on figure overleaf. In the case of a backwards direction, the search starts immediately in front of the selection if there is one , see position B on figure overleaf, or the end of the document if not, see position D on figure overleaf. The result is true if the text was found in the page and false if it was absent.
2420
Error! No text of specified style in document.
B
C
selection
A
D
See also:
Frame object, Window object, Window.home(), Window.print(), Window.stop()
Window.focus() (Method) Send a focus event to the window object. Availability:
Property/method value type: JavaScript syntax:
JavaScript - 1.1 JScript - 3.0 Internet Explorer - 4.0 Netscape - 3.0 Opera - 3.0 undefined -
focus()
-
myWindow.focus()
This restores focus to the receiving window or frame that the method is executed on. If the focus goes to a frame, then by implication, the window it belongs to becomes active too. On some platforms this will bring the receiving window to the foreground if it is not already the active window. It is generally better technique to use the focus() method on another window rather than call the blur() method if you want to remove focus from a window. However, that may not always be possible if you want to completely remove focus from all windows. The consequence may be that the window becomes inactive and on some platforms it means the window will be placed at the rear of any other windows on the screen.
2421
Chapter number
Warnings: ❑
This method is not supported by MSIE version 3. See also:
Frame object, Input.blur(), Input.focus(), Window object, Window.blur(), Window.onblur, Window.onfocus
Window.forward() (Method) Mimics the effect of the user clicking on the FORWARD button. Availability: Property/method value type: JavaScript syntax:
JavaScript - 1.2 Netscape - 4.0 undefined N
forward()
N
myWindow.forward()
The browser will behave as if the user had clicked on the FORWARD navigation button.
Warnings: ❑
If this is executed in a contained window, the behavior of the window.forward() method may not always be consistent with the history.forward() method. One may simply affect the frame while the other may affect the entire browser window at the top of the frame-set hierarchy. See also:
Frame object, History.forward(), Window object, Window.back()
Window.frame (Property) This is another name for self and window. Availability: Property/method value type: JavaScript syntax:
JScript - 5.0 Internet Explorer - 5.0 Window object IE
frame
IE
myWindow.frame
This property yields an object that represents the frame that contains this window object. This is the same value that the window property yields. It is another gratuitous extension that MSIE provides so that scripts to run inside frames can look more consistent with what they are doing and yet break on any non-MSIE browsers due to the frame property not being present. Frame objects support all the methods and properties of window objects although they may not always be meaningful in the context of a frame living in a frame-set.
2422
Error! No text of specified style in document.
Of course, you can emulate this in other browsers by assigning the value of the window.window property to the window.frame property anyway. This appears to be undocumented and does not appear in the Microsoft reference information. Nevertheless, the property is visible by enumeration of the window object and appears to work.
Warnings: ❑
Using this property renders your scripts non-portable unless you code around the missing property on non-MSIE browsers. See also:
Document.parentWindow, self, Window object, Window.self, Window.top, Window.window
Property attributes: ReadOnly.
Window.frameRate (Property) An indication of the frame rate for the current display. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
Number primitive
JavaScript syntax:
N
frameRate
N
myWindow.frameRate
This property was discovered accidentally by enumerating the properties of a window object in the Netscape Navigator browser. The name of this property suggests that it should yield the rate at which the display is refreshed. This should be a constant value and you would expect this to be somewhere between 50 and 85.
Property attributes: ReadOnly.
Window.frames[] (Collection) An array containing window objects, each one referring to the content of a frame within the window. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
2423
Chapter number
Property/method value type:
Frames object
JavaScript syntax:
-
frames
-
myWindow.frames
HTML syntax:
<IFRAME>
The frames property yields an array containing objects, each one of which refers to a separate frame. You can count how many there are with the window.frames.length property. In MSIE, this also includes any inline floating frames created with an <IFRAME> tag. You can cross-reference between frames in a window by means of the frames property. Every window refers to a frames array, which contains a list of frames within that window. Each frame contains a different window. This can get confusing, but it simply means that frames correspond to windows at the basic object level. You can also use the opener, parent and top properties as well when you are cross-referencing between windows and frames. Frames arrays may be nested where windows contain frames within frames. The frames array is like all others, its first element is at index 0. This means that something as confusing as this is legal: frames[0].frames[2].frames[1] As a window reference, that looks in the current window for the first frame, then into the third frame within that and then the second frame within that. You can use the parent window reference to access windows that are all at the same hierarchical level as the current one. This would be accomplished like this: parent.frames[ ... ]
Warnings: ❑
Be careful not to confuse this with the document.frames property supported by MSIE. That is intended just to list the inline frames within a document.
❑
In Netscape Navigator the window.frames property points back at the window object and the frame objects and frames.length property are stored there as global variables. This is arguably a bug although not all commentators agree. The MSIE implementation is much neater however in that environment, all elements having an ID HTML tag attribute are reflected as member properties of the window. This is not correct either since they should be members of the document and not the window.
❑
Strangely enough, it all seems to work from the scripting point of view. You can access the length value to count the frames and the individual frame objects are available associatively by name from the window.frames property.
2424
Error! No text of specified style in document.
See also:
<MAP TARGET="...">, Document object, Document.frames[], Frame object, Frames object, Window object, Window.opener, Window.parent, Window.top
Property attributes: ReadOnly.
Cross-references: Wrox Instant JavaScript – page - 80
Window.handleEvent() (Function) Pass an event to the appropriate handler for the window. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
undefined
JavaScript syntax:
N
handleEvent(anEvent)
N
myWindow.handleEvent(anEvent)
anEvent
An event to be handled by this object
Argument list:
This applies to Netscape Navigator prior to version 6.0. From that release onwards, event management follows the guidelines in the DOM level 2 event specification. On receipt of a call to this method, the receiving object will look at its available set of event handler functions and pass the event to an appropriately mapped handler function. It is essentially an event dispatcher that is granular down to the object level. The argument value is an event object that contains information about the event. See also:
Event object, Event propagation, Frame object, handleEvent(), SubmitButton.handleEvent(), TEXTAREA.handleEvent(), TextCell.handleEvent(), Window object, Window.routeEvent()
2425
Chapter number
Window.history (Property) This property returns a history object for this window. Availability:
JavaScript - 1.1 JScript - 3.0 Internet Explorer - 4.0 Netscape - 3.0 Opera - 3.0
Property/method value type:
History object
JavaScript syntax:
-
history
-
myWindow.history
This property yields a reference to a history object for the session in this window. The history object is somewhat like an array of history items. Netscape Navigator supports a slightly more sophisticated history object than MSIE. On MSIE, you can access methods belonging to the history object with a construct like this: window.history.go(0); Nevertheless, you cannot access member properties of the history object to examine URL values as this contradicts the security requirements.
Warnings: ❑
This appears to be only partially supported on MSIE for Macintosh. See also:
Frame object, History object, Window object
Property attributes: ReadOnly.
Window.home() (Method) This duplicates the behavior of the HOME button on the Netscape Navigator button bar. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
undefined
JavaScript syntax:
N
home()
N
myWindow.home()
2426
Error! No text of specified style in document.
The result of calling this method depends on what you have set up as your home page in the browser. By default, it is likely to be a page on the web site belonging to the browser manufacturer. Commonly though, it will be a blank page because after you have been irritated by your browser automatically dialling in to your ISP, you'll likely have told it not to go to any home page by default. See also:
Frame object, Window object, Window.find(), Window.print(), Window.stop()
Window.innerHeight (Property) The height of the window inside the frame. Availability:
JavaScript - 1.2 Netscape - 4.0 Opera - 5.0
Property/method value type:
Number primitive
JavaScript syntax:
-
innerHeight
-
myWindow.innerHeight
This property is supported on Netscape Navigator and tells you what the current height of the content area of the window is set to. Assigning a value to this property will resize the window on Netscape Navigator. On MSIE it will be ignored. innerWidth
innerHeight
Warnings: ❑
This method requires your script to be granted the UniversalBrowserWrite privilege to set a window size smaller than 100x100 pixels. See also:
Frame object, UniversalBrowserWrite, Window object, Window.innerWidth, Window.outerHeight, Window.outerWidth
2427
Chapter number
Window.innerWidth (Property) The width of the window inside the frame. Availability:
JavaScript - 1.2 Netscape - 4.0 Opera - 5.0
Property/method value type:
Number primitive
JavaScript syntax:
-
innerWidth
-
myWindow.innerWidth
This property is supported on Netscape Navigator and tells you what the current width of the content area of the window is set to. Assigning a value to this property will resize the window on Netscape Navigator. On MSIE it will be ignored. innerWidth
innerHeight
Warnings: ❑
This method requires your script to be granted the UniversalBrowserWrite privilege to set a window size smaller than 100x100 pixels. See also:
2428
Frame object, UniversalBrowserWrite, Window object, Window.innerHeight, Window.outerHeight, Window.outerWidth
Error! No text of specified style in document.
Window.java (Property) A reference to the Java package object that is the root of the 'java.*' packages tree. Availability:
JavaScript - 1.1 Netscape - 3.0
Property/method value type:
JavaPackage java
JavaScript syntax:
N
java
N
myWindow.java
N
myWindow.Packages.java
N
Packages.java
The object referred to by this property sits at the top of the java package name hierarchy. It is through this property that you can access the java objects, properties and methods via LiveConnect. This shortcut reference corresponds to a directory hierarchy where Java class, packages are stored. Thus the java.lang.String class lives in a file called java/lang/String.class which on some systems may be stored inside a ZIP archive. The main shortcoming in this whole mechanism is that the browser cannot tell whether a reference to an object is a request for a JavaPackage or a JavaClass. It will assume you mean a package by default and if you misspell a class name, it won't tell you it couldn't find it. The objects and classes supported by this access to the underlying Java engine cover a very wide topic base. We have examined only the top level functionality to try and establish points of connection between the two environments. For a full and in-depth reference coverage of the Java language environment, consult the Wrox book "Java Programmer's Reference" by Grant Palmer. root
netscape
java
lang
See also:
io
sun
applet
JavaPackage object, LiveConnect, Packages.java, Window.netscape, Window.Packages, Window.sun
2429
Chapter number
Property attributes: ReadOnly.
Window.length (Property) The number of frames in the window. Availability:
JavaScript - 1.0 JScript - 3.0 Internet Explorer - 4.0 Netscape - 2.0 Opera - 3.0
Property/method value type:
Number primitive
JavaScript syntax:
-
frames.length
-
length
-
myWindow.frames.length
-
myWindow.length
The same value as the window.frames.length property. This property is maintained in MSIE for consistency with Netscape Navigator. The frames in MSIE are contained in a FrameArray object, but this does not prevent their names polluting the property namespace of the Window object.
See also:
Collection.length, Frame object, length, Window object
Property attributes: ReadOnly.
Window.location (Property) A reference to the location object that represents the URL of the current window content. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Property/method value type:
Location object
JavaScript syntax:
-
location
-
myWindow.location
2430
Error! No text of specified style in document.
The attributes of the object referred to by this property can be read or written to cause the window content to be reloaded under script control. The object itself ought to be considered read only but its properties are modifiable. Consult the document for the location object for details of what you can read or write. In particular, refer to the window.location.href value as a way to load a new document into the window.
Warnings: ❑
Do not confuse this location object with that belonging to the document. They are different.
❑
Older versions of the web browsers used to treat this property as a read/write string containing the URL. The access to the URL value is now via the properties of the object referred to by this property and not via the property itself. See also:
Document.location, Document.referrer, Document.URL, Frame object, Location object, Window object, Window.navigate()
Property attributes: ReadOnly.
Window.locationbar (Property) A reference to an object that represents the location bar. Availability:
JavaScript - 1.2 Netscape - 4.0 Opera - 5.0
Property/method value type:
Bar object
JavaScript syntax:
-
locationbar
-
myWindow.locationbar
This is a read only property containing a reference to a Bar object whose visible property contains a Boolean value that controls the visibility of the screen furniture represented by the object. In this case, it is supposed to control the visibility of the location bar. The example shows how this can be done in a secure way that requires privilege to be granted and in a non-secure way that does not.
Warnings: ❑
Your script will need to be granted the UniversalBrowserWrite privilege to allow it to change the visibility of the locationbar.
2431
Chapter number
Example code: // Request necessary privilegesnetscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrit e"); // Hide location barwindow.locationbar.visible = false; // There is another way that works without requesting privilegewindow.open('', '_top', 'location=0');
See also:
Bar object, Frame object, UniversalBrowserWrite, Window furniture, Window object, Window.menubar, Window.personalbar, Window.scrollbars, Window.statusbar, Window.toolbar
Property attributes: ReadOnly.
Window.menubar (Property) A reference to an object that represents the menu bar. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
Bar object
JavaScript syntax:
-
menubar
-
myWindow.menubar
This is a read-only property containing a reference to a Bar object whose visible property contains a Boolean value that controls the visibility of the screen furniture represented by the object. In this case, it is supposed to control the visibility of the menu bar. The example shows how this can be done in a secure way that requires privilege to be granted and in a non-secure way that does not.
Warnings: ❑
Your script will need to be granted the UniversalBrowserWrite privilege to allow it to change the visibility of the menubar.
❑
The Macintosh version of Netscape Navigator requires that the window be made inactive and then active again after the status of this item has changed for there to be any noticeable effect.
❑
Even then, not all items in the menubar are hidden but most are.
❑
Be careful if you set the menubar and toolbar to invisible, you will then have no reload capability to be able to refresh the screen. You will then only be able to quit.
2432
Error! No text of specified style in document.
❑
On some platforms, there may still be a refresh capability available on the contextual menu inside the window. This will depend on whether the contextual menu is still available or whether it has been changed to remove the refresh item.
Example code: // Request necessary privileges netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite"); // Hide menu bar window.menubar.visible = false; // There is another way that works without requesting privilege // window.open('', '_top', 'menubar=0');
See also:
Bar object, Frame object, UniversalBrowserWrite, Window furniture, Window object, Window.locationbar, Window.personalbar, Window.scrollbars, Window.statusbar, Window.toolbar
Property attributes: ReadOnly.
Window.moveBy() (Method) Move the window by a specified distance. Availability:
JavaScript - 1.2 JScript - 3.0 Internet Explorer - 4.0 Netscape - 4.0
Property/method value type:
undefined
JavaScript syntax:
-
moveBy(anOffsetX, anOffsetY)
-
myWindow.moveBy(anOffsetX, anOffsetY)
anOffsetX
A distance in pixels
anOffsetY
A distance in pixels
Argument list:
This method will translate a window across the screen. Positive values move the window to the right and down while negative values move the window to the left and up.
2433
Chapter number
moveBy()
Delta X
Warnings: ❑
There are some security implications for moving windows in Netscape 4. They are intended to stop you hiding a window by shifting it off-screen. Your script will need to be granted the UniversalBrowserWrite privilege to allow it to move the window outside the screen area. See also:
Frame object, UniversalBrowserWrite, Window object, Window.moveTo(), Window.onmove, Window.pageXOffset, Window.pageYOffset, Window.resizeBy(), Window.resizeTo(), Window.scrollBy()
Window.moveTo() (Method) Move the window to a specific location. Availability:
JavaScript - 1.2 JScript - 3.0 Internet Explorer - 4.0 Netscape - 4.0
Property/method value type:
undefined
JavaScript syntax:
-
moveTo(aCoordX, aCoordY)
aCoordX
myWindow.moveTo(aCoordX, aCoordY)
aCoordY
A position in pixels
Argument list:
2434
A position in pixels
Error! No text of specified style in document.
This method will locate a window at a specific position on screen. Offset X
Offset Y
Warnings: ❑
There are some security implications for moving windows in Netscape 4. They are meant to stop you hiding a window by shifting it off-screen. Your script will need to be granted the UniversalBrowserWrite privilege to allow it to move the window outside the screen area. See also:
Frame object, UniversalBrowserWrite, Window object, Window.moveTo(), Window.onmove, Window.pageXOffset, Window.pageYOffset, Window.resizeBy(), Window.resizeTo(), Window.scrollBy()
Window.name (Property) The name of the window either from the tag, the Window.open() method call or an assignment to this property. Availability:
DOM level - 1 JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Property/method value type:
String primitive
2435
Chapter number
JavaScript syntax:
HTML syntax: Argument list:
-
myWindow.name
-
myWindow.name = aString
-
name
-
name = aString
-
window.open(aURL, aName, ...)
Window.open(...) aName
A name for the window
aString
A string value containing the new name for the window
aURL
A URL to load into the window
This name value can be used with the target attribute of the HTML anchor tag or the tag. At version 1.0 of JavaScript this is a read-only property. JavaScript version 1.1 introduces the capability of changing the name of a window and makes this property writable. This is particularly useful because the initial window has no name and cannot be targeted directly until it has. You can fix this with an onLoad handler. The name of a window can be set when the window is created with the open() method. It is also assigned by the NAME="..." HTML tag attribute of a tag. The example shows the window name being modified. Reload to see the persistence effect. Load another document and then load this script again to see how the name persists through intermediate document loads.
Warnings: ❑
This is not the title text for the window.
❑
Note that the name value persists through document loads and so you may need to be careful if you are using the name property in a document script. It might have been set by an earlier page. This also suggests that other window properties may be persistent between documents and might provide a way to pass messages between pages and maintain state during a session.
Example code: <SCRIPT> document.write("***"+window.name+"
"); window.name = "FRED"; document.write("***"+window.name+"
");
2436
Error! No text of specified style in document.
See also:
Frame object, IFRAME.name, NAME="...", Window object, Window.open()
Window.navigate() (Method) Load a new URL into the window. Availability:
JScript - 1.0 Internet Explorer - 3.02
Property/method value type:
undefined
JavaScript syntax:
IE
myWindow.navigate(aURL)
IE
navigate(aURL)
aURL
A new location to navigate the window to
Argument list:
This is functionally similar to assigning a new value to the window.location.href property. Because it is only available in MSIE you should avoid using this in cross-browser development.
Warnings: ❑
Because this is only supported in MSIE, you should not use it if you want to develop portable scripts. A more portable technique is to assign the URL value to the href property of the location object that is accessible from the window.location property.
❑
window.navigate("index.html"); and window.location.href = "index.html"; are functionally equivalent and guaranteed to be portable between Netscape Navigator and MSIE if not across all available browsers.
Example code: // Reload the window with a new relative URL valuewindow.navigate("_Window.html");
See also:
Location object, Window.location
Window.navigator (Property) A reference to a navigator object that describes the browser. Availability:
JavaScript - 1.0 JScript - 3.0 Internet Explorer - 4.0 Netscape - 2.0 Opera - 3.0
Property/method value type:
Navigator object
JavaScript syntax:
-
myWindow.navigator
-
navigator
2437
Chapter number
The navigator object was originally provided by Netscape Navigator as a way of making client properties available to scripts.
Warnings: ❑
Microsoft have property named clientInformation that points at the same object. This then allows people to write scripts that are functionally identical but which will break on Netscape Navigator and Opera, although perhaps we should give them the benefit of the doubt because really this property should have been called clientInformation in the first place. Frame object, Navigator object, Window object, Window.clientInformation
See also:
Property attributes: ReadOnly.
Window.netscape (Property) A reference to the Java package object that is the root of the 'netscape.*' Packages tree. Availability:
JavaScript - 1.1 Netscape - 3.0
Property/method value type:
JavaPackage netscape
JavaScript syntax:
N
myWindow.netscape
N
myWindow.Packages.netscape
N
netscape
N
Packages.netscape
The object referred to by this property sits at the top of the Netscape package name hierarchy. It is through this property that you can access the java objects, properties and methods via LiveConnect. root
netscape
java
lang
See also:
2438
io
sun
applet
JavaScript to Java values, Packages.netscape, Window.java, Window.Packages, Window.sun
Error! No text of specified style in document.
Property attributes: ReadOnly.
Window.offscreenBuffering (Property) A property that controls off-screen buffering effects. Availability:
JavaScript - 1.2 JScript - 3.0 Internet Explorer - 4.0 Netscape - 4.0
Property/method value type:
Boolean or String primitive
JavaScript syntax:
-
myWindow.offScreenBuffering
-
myWindow.offScreenBuffering = aSetting
-
offScreenBuffering
-
offScreenBuffering = aSetting
aSetting
A new value to control this functionality
Argument list:
This property controls how screen updates are accomplished. This is especially useful with DHTML-based animation. An off-screen buffer is used to draw the new window contents and then copy it over the existing content when it is complete. This is much nicer to look at than the effects you get with a non-buffered redraw which clears the screen first and then draws the entire page in front of you. The available settings are: Boolean true - Activate off-screen buffering Boolean false - Deactivate off-screen buffering String "auto" - Let the browser decide for itself In general, MSIE accomplishes slightly more attractive redraws with this facility enabled than Netscape Navigator. However, new versions of Mozilla 5 and Netscape 6 may surpass the MSIE version 5 support.
Warnings: ❑
Enabling this facility will slightly decrease CPU performance and consume more memory since a copy of the onscreen window needs to be maintained in the application memory. See also:
Frame object, Window object
2439
Chapter number
Window.onblur (Property) This is called when the window loses input focus. Availability:
JavaScript - 1.1 JScript - 3.0 Internet Explorer - 4.0 Netscape - 3.0 Opera - 3.0
Property/method value type:
Function object
JavaScript syntax:
-
myWindow.onblur
-
myWindow.onblur = aHandler
-
onblur
HTML syntax:
onblur = aHandler
Argument list:
aHandler
An event handler function object
A blur event is caused by the user clicking on another window or frame or the window.blur() method being called. When this event is triggered, an onblur event handler will be invoked. The onblur event handler is a function which is represented by an object that is referred to by this property. Because it is stored in a property, you can change the handler by storing a reference to a different function object in this property. At least, you can on MSIE. You cannot redefine the value of the window.onblur property from inside the onblur function handler. This means you can't modify the onblur behavior while a blur event is in progress. The handler is registered either by assigning a function to the onblur property or by defining it with an HTML tag attribute.
Warnings: ❑
Do not use to make sure the window is always on top. This does not work as you expect. The problem is caused because the BODY receives a blur event when any element inside the page takes the focus away from it (for example, when you click on a link or form element). The page becomes unusable because every attempt to click elements in the page triggers a javascript call that draws the focus straight back to the BODY/ window. So all you get is a window that permanently blocks all the other windows but does not allow any elements inside it to be used.
❑
In Netscape Navigator, the property is not enumerable if the value is defined with an onBlur="..." HTML tag attribute. However, it is enumerable if the property is assigned within JavaScript without there being a defining tag attribute. There may be a general rule that script defined properties are always enumerable, while internally created properties may not be.
❑
Displaying an alert(), confirm() or prompt() dialog takes focus away from a window. Don't forget that your blur handler will be called if this happens.
❑
The Macintosh version 4.7 of Netscape Navigator does not appear to support blur events.
2440
Error! No text of specified style in document.
See also:
onBlur, Window.blur(), Window.focus(), Window.onfocus
Property attributes: DontEnum.
Window.ondragdrop (Property) This event handler is called when an object is dropped into the browser window. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
Function object
JavaScript syntax:
-
myWindow.ondragdrop
-
myWindow.ondragdrop = aHandler
-
ondragdrop
HTML syntax:
ondragdrop = aHandler
Argument list:
aHandler
An event handler function object
This event handler is invoked when the user drags an item onto a window in Netscape Navigator. To access the details of the entity that has been dragged into and dropped on the window, you need to access the data property of the event object that is passed as an argument to the handler when it is called. The data is a single URL when a single entity is dropped into the window or an array of strings, each containing an URL, when a collection of entities are dropped onto a window. You will need UniversalBrowserRead privilege to access this data. The handler is registered either by assigning a function to the ondragdrop property or by defining it with an HTML tag attribute.
Warnings: ❑
Note that this does not appear to work in Netscape 4.7 for Macintosh. See also:
Event.data, onDragDrop
Property attributes: DontEnum.
2441
Chapter number
Window.onerror (Property) A reference to an error event handler for this window object. Availability:
JavaScript - 1.1 JScript - 3.0 Internet Explorer - 4.0 Netscape - 3.0 Opera - 3.0
Property/method value type:
Function object
JavaScript syntax:
-
myWindow.onerror
-
myWindow.onerror = aHandler
-
onerror
-
onerror = aHandler
aHandler
An event handler function object
Argument list:
You can register an error handler function by assigning a function object to the window's onerror property so that when an error occurs in the JavaScript within the window, that function will be called. This can be a useful way of trapping and completely inhibiting the display of error messages to the user. When the error handling function is called, it is passed three arguments: ❑
The textual message that explains the error
❑
The URL of the document that contains the error
❑
The line number within that document where the error occurred
The line number is the physical line number within the document, not a line number within a script, so you should be able to open the document in a text editor and go to the indicated line and identify the problem. The only way to activate this error handling capability is to assign a function to the onerror property. There is no HTML tag attribute mechanism for defining an error handler for a window although you can associate one with the tag with an attribute value. You can return either true or false as a result of calling your handler: true - Inhibit any further error processing and abort the script. false - Hand control back to the browser to deal with the error in the normal way. Deactivate error handling altogether by calling a function that simply returns true. To restore default error handling to the window later, assign a function handler to the property that merely returns a false value as its result without intervening in the error process in any way.
2442
Error! No text of specified style in document.
Warnings: ❑
Beware of the return values. Returning true from an error handler inhibits the browser from carrying out any further action. This is exactly opposite to the return value from a form element event handler, which requires that a false value be returned to inhibit any further action by the browser.
❑
This works on version 4 of Netscape Navigator. It is also fully supported by MSIE version 5. Version 4 of MSIE for Macintosh (and possibly other platforms) allows the error to be trapped but does not pass any meaningful argument values. They are all undefined.
❑
This is not supported on the WebTV platform.
❑
There is a problem with this event handler hook in the Netscape 6.0 browser. The values are not passed to the handler correctly although the handler is called. See also:
Debugging - client-side, Error events, Error handler, JellyScript, onError
Property attributes: DontEnum.
Window.onfocus (Property) This event handler is called when a window gains the input focus. Availability:
JavaScript - 1.1 JScript - 3.0 Internet Explorer - 4.0 Netscape - 3.0 Opera - 3.0
Property/method value type:
Function object
JavaScript syntax:
-
myWindow.onfocus
-
myWindow.onfocus = aHandler
-
onfocus
HTML syntax:
onfocus = aHandler
Argument list:
aHandler
An event handler function object
A focus
2443
Error! No text of specified style in document.
Argument list:
aURL
A URL to load into the modeless dialog
someArguments
Arguments to pass to the modeless dialog
someFeatures
Window adornment features
The MSIE browser supports a special window that behaves like a modal dialog but can be switched into the background. This is therefore a modeless dialog. Because it does not operate in a modal fashion, it does not lock out other activity in the browser. Having called this method to display a modeless dialog, the function returns immediately and the script that called it will continue execution. The opening window can continue to receive input if necessary, which you might find useful for opening palette windows, for example. The result of this method call is a reference to the window object that represents the modeless dialog. You must specify a URL value in the first argument for a document to be loaded into the window. The second argument passes some arguments to the modeless dialog in the same way as you might to a modal dialog. A third optional argument can be specified in a similar way to the feature list of a window. showModalDialog() method. However, note that the feature list is different to that for a normal window created with a window.open() method call. Refer to the window.showModalDialog() topic for details of the feature list for modal or modeless dialog windows. See also:
Dialog boxes, Dialog objectWindow.showModalDialog()
Window.sidebar (Property) A reference to an object that represents the sidebar frame in Netscape 6.0. Availability:
JavaScript - 1.5 Netscape - 6.0
Property/method value type:
Sidebar object
JavaScript syntax:
N
myWindow.sidebar
N
sidebar
This is a new property introduced to support the sidebar in Netscape 6. In essence this introduces a permanent second frame that can be used to hold navigational content. Actually its capabilities seem quite powerful and since it can have HTML loaded into it and can be addressed with JavaScript some interesting possibilities await us as we explore it further. See also:
Sidebar object
2485
Chapter number
Window.status (Property) A property containing the text displayed in the status bar. Availability:
Property/method value type: JavaScript syntax:
Argument list:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0 String primitive -
myWindow.status
-
myWindow.status = aString
-
status
aString
status = aString A string to display in the status bar
This property should be used to set a transient value for the status bar when providing some rollover management. This is ideal for use in event handlers or fragments of code being executed with a deferred task. Normally setting this from a script would display the status text only momentarily until the user moved the mouse or the document finished loading. When the status text is erased, the defaultStatus value of the window will usually be the text that overwrites it, unless some other text is called in the meantime. It really depends on what event handlers are invoked as the mouse moves. In Netscape Navigator, setting the status value in a submit button onClick handler instantly updates the value displayed in the status bar. However as soon as you roll off the button, the defaultStatus value is displayed instead and the transient status value is lost. Rolling back onto the submit button won't display it again because it was set by the onClick handler. In MSIE, the behavior of the status and defaultStatus properties is so nearly identical as to be hard to distinguish one from the other. The status message box belongs to the top level window. This means that it behaves with some slight differences if there are multiple frames and the status and defaultStatus properties are set from inside them. This is also prone to differences between browsers and it is recommended that you experiment somewhat to achieve exactly the desired behavior you want to make sure it is consistent across the two main browsers. Setting this value in the onMouseOver event handler requires that you signal the browser to not immediately update the status bar value when the handler exits. To do this, return a Boolean true value to inhibit any further browser activity. Likewise, you'll also need to do this in a onMouseMove handler. The example illustrates a simple "mouse'O'meter" to display the current mouse coordinates as the mouse moves. This only works in MSIE, however, and then only while the window has focus. This might be useful when working out where to position objects with dynamic HTML.
2486
Error! No text of specified style in document.
Frame-set contents that run script to set status bar values might operate better if you explicitly tell them to set the status property that belongs to the top level window. That is accessible via the top property, thus: top.status = "ABCD"; window.top.status = "ABCD"; top.defaultStatus = "ABCD"; window.top.defaultStatus = "ABCD";
Warnings: ❑
Beware that some browsers do not correctly restore the status bar to its default condition after the rollover is deactivated by moving the mouse pointer somewhere else. This is the case for Netscape 2 and 3 on the Windows platform. Adding an onMouseOut handler may provide a satisfactory work around.
Example code: <SCRIPT> // An example mouse coordinate display for MSIE
function mouseOmeter() { window.status = window.event.x + "," + window.event.y; return true; }
See also:
Frame object, onMouseOut, onMouseOver, Status line, Window object, Window.defaultStatus
Window.statusbar (Property) A reference to an object that represents the status bar. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
Bar object
JavaScript syntax:
-
myWindow.statusbar
-
statusbar
This is a read-only property containing a reference to a Bar object whose visible property contains a Boolean value that controls the visibility of the screen furniture represented by the object, in this case, the status bar.
2487
Chapter number
Warnings: ❑
Your script will need to be granted the UniversalBrowserWrite privilege to allow it to change the visibility of the status bar.
Example code: // Request necessary privileges netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite"); // Hide status bar window.statusbar.visible = false; // There is another way that works without requesting privilege // window.open('', '_top', 'status=0');
See also:
Bar object, Frame object, UniversalBrowserWrite, Window furniture, Window object, Window.locationbar, Window.menubar, Window.personalbar, Window.scrollbars, Window.toolbar
Property attributes: ReadOnly.
Window.stop() (Method) This duplicates the behavior of the Stop button on the Netscape Navigator button bar. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
undefined
JavaScript syntax:
-
myWindow.stop()
-
stop()
This is a means of immediately halting the script being executed. It’s likely this will mainly be used in an error handler, although you may want to conditionally prevent a form from being submitted. It is effectively the same as clicking on the Stop button in the toolbar.
Warnings: ❑
Since this is only supported on Netscape Navigator, it is not a portable feature and not recommended for deployment. See also:
2488
Frame object, Window object, Window.find(), Window.home(), Window.print()
Error! No text of specified style in document.
Window.sun (Property) A reference to the Java package object that is the root of the 'sun.*' Packages tree. Availability:
JavaScript - 1.1 Netscape - 3.0
Property/method value type:
JavaPackage sun
JavaScript syntax:
N
myWindow.Packages.sun
N
myWindow.sun
N
Packages.sun
N
sun
The object referred to by this property sits at the top of the sun package name hierarchy. It is through this property that you can access the java objects, properties and methods via LiveConnect.
root
netscape
java
lang
See also:
io
sun
applet
JavaPackage object, Window.java, Window.netscape, Window.Packages
Property attributes: ReadOnly.
Window.toolbar (Property) A reference to an object that represents the tool bar. Availability:
JavaScript - 1.2 Netscape - 4.0
Property/method value type:
Bar object
JavaScript syntax:
-
myWindow.toolbar
-
toolbar
2489
Chapter number
This is a read-only property containing a reference to a Bar object whose visible property contains a Boolean value that controls the visibility of the screen furniture represented by the object, which, in this case, is the toolbar.
Warnings: ❑
Your script will need to be granted the UniversalBrowserWrite privilege to allow it to change the visibility of the toolbar.
❑
Be careful if you set both the menubar and toolbar to invisible, you will then have no reload capability to be able to refresh the screen. You will then only be able to quit.
❑
In the Netscape Navigator 4 browser for Macintosh, setting the toolbar invisible and then visible restores the tool bar but hides the menu items. On that platform, hiding the toolbar also hides all the other window furniture such, as locationbar and statusbar.
Example code: // Request necessary privilegesnetscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrit e");// Hide tool barwindow.toolbar.visible = false;// There is another way that works without requesting privilegewindow.open('', '_top', 'toolbar=0');
See also:
Bar object, Frame object, UniversalBrowserWrite, Window furniture, Window object, Window.locationbar, Window.menubar, Window.personalbar, Window.scrollbars, Window.statusbar
Property attributes: ReadOnly.
Window.top (Property) The topmost window in a framed hierarchy. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Property/method value type:
Window object
JavaScript syntax:
-
myWindow.top
-
top
2490
Error! No text of specified style in document.
The top property should consistently refer to the window at the top of the hierarchy. The window property refers to the current window. You can test attributes of the top window against attributes of the current window to see if your script is running in a correctly framed context. This may be useful if you have a frame dependent page that may have been linked to by a search engine. You can force the page into the correct frame-set if you can detect that it has been invoked outside of it. if(top != window) { // The window is in a frameset } This property will contain a meaningful value regardless of whether the window is in a frame or not. If the pages are known to come from the same server, you may want to check the window.location.href property against the top.location.href property. However, this may cause problems if the pages come from different servers and cause the script to throw a security related exception.
Warnings: ❑
Note that this value is not necessarily the same as the parent property. See also:
Frame object, Window object, Window.frame, Window.frames[], Window.parent, Window.window
Property attributes: ReadOnly.
Window.window (Property) Another name for the self property. Availability:
JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Opera - 3.0
Property/method value type:
Window object
JavaScript syntax:
-
myWindow.window
-
window
This is another name for the window.self property in this context. However, window is useful because you can remove the ambiguity associated with accessing global object properties and methods. Don't forget that this can also refer to a frame as well as a window since they are both represented by the window object.
2491
Chapter number
If the script is running in the topmost window of a frame-set or within a non-frame-set window, the top property will also be set to the same value. This property is slightly odd, because the window object is also the global object for a web browser. The global object is always placed in the scope chain for a script's execution context. So, all properties that belong to the window are available without requiring the window object prefix. So, these all refer to the same thing: window window.self self window.window self.self self.window.self window.window.window.window.window.self.window The main use of this property is to yield slightly better readability and clarity in the code you write. The same applies to the self property. It is better to explicitly call window.open() rather than just open(). Explicitly calling window.open() avoids an inadvertent call to document.open(). You might not be aware of an open() method belonging to another object that has been placed into the scope chain ahead of the window object. Window.top
Frame 1
Frame 2
Window.self
2492
Frame 3
Frame 4
Error! No text of specified style in document.
Warnings: ❑
Be careful if you are building recursive scripts to walk the window hierarchy, as you could find yourself in an endless loop simply walking via the window property of the top level window. See also:
Frame object, Window object, Window.frame, Window.self, Window.top
Property attributes: ReadOnly.
Windows Script Host (Product) A scripting environment available on the Windows platform. On the Apple Macintosh, the AppleScript operating system extension has provided a way for applications to exploit AppleEvents and execute script-based control over one another. On Windows, Microsoft introduced Windows Script Host (WSH), which provides a script-driven interface to the underlying COM model. This is a great improvement on the DOS batch commands that were available prior to this. Its still doesn't integrate applications in the way that AppleScript does, instead it integrates data objects with one another, which in some ways may be more powerful as it is a document-centric system. However, it can be difficult to exploit specific capabilities of applications unless they are COM related. Like AppleEvents, WSH is language independent and you have a choice of languages that you can use for scripting. JScript is becoming more favored lately, although much has been made of VBScript, although it's not as powerful as Visual Basic, on which it is based. For an in-depth discussion on WSH, consult the Wrox Professional JavaScript book, where a whole chapter is devoted to WSH.
with ... (Statement) Adds an object to the front of the scope chain for use in the following block of script code. Availability:
ECMAScript edition - 2 JavaScript - 1.0 JScript - 1.0 Internet Explorer - 3.02 Netscape - 2.0 Netscape Enterprise Server - 2.0 Opera - 3.0
JavaScript syntax:
-
with( anObject ) { someCode };
someCode
Some code to execute with the enhanced scope chain
anObject
A reference to an object to add to the scope chain
Argument list:
This statement is provided as a convenience mechanism to simplify your script code and save time and trouble.
2493
Chapter number
When a statement executes, your line of script is running in one context or another. Each context is created and destroyed as functions are called and exit respectively. The contexts are added to an inheritance chain, which allows variables to be shared globally or locally. The with keyword adds an object to the front of the scope chain for the current execution context. This saves you having to describe the full object reference since it is placed in the scope chain and always available and implicitly provided by JavaScript when resolving references to identifiers. The code in the statement block is then executed while this augmented scope chain is in place. The object that is added to the scope chain is computed by the expression value in parentheses. When the statement block is executed, the scope chain is restored to its original condition. This happens regardless of how the statement block is completed. Although the ECMA standard is ambiguous on this point, the implication is that a break might be appropriate in this context. A continue or return in the statement block would be inappropriate unless perhaps the with() construct is used within an iterator or function. Because of this ambiguity, you may find this behaves differently according to the implementation you are using. The with statement can save you effort typing object names over and over again.
Warnings: ❑
Even though it is very convenient, it is considered somewhat bad form to use this construct. The code is hard to optimize inside the interpreter, which means it will likely run more slowly. Functions and variables instantiated inside a with block do not behave consistently, so it is recommended that you avoid using this construct.
Example code: // Create a new object var myObject = new Object; // Add a property containing another object myObject.itsObject = new Object; // Add a property to that object myObject.itsObject.someProperty = "String text"; // Now enhance the scope chain with(myObject.itsObject) { document.write(someProperty); }
See also:
Identifier, Identifier resolution, Scope chain, Statement
Cross-references: ECMA 262 edition 2 – section - 10.1.4 ECMA 262 edition 2 – section - 12.10 ECMA 262 edition 3 – section - 10.1.4 ECMA 262 edition 3 – section - 12.10 Wrox Instant JavaScript – page - 35
2494
Error! No text of specified style in document.
WML (Standard) Wireless Mark-up Language. This is the markup language used to describe cards (analogous to pages) in a wireless mobile device. This is the framework in which the WScript code will run. This is variously referred to as WScript and WMLScript and should not be confused with the WScript that Microsoft refer to as being a component of WSH. See also:
Interpret, WAP, WScript
WScript (Standard) Otherwise known as WMLScript or WAP Script – a variation of JavaScript for use in mobile devices. This is the somewhat modified version of JavaScript, which is used in WAP mobile devices such as cellphones.
Warnings: ❑
Be aware that Microsoft have implemented a WScript object as part of the WSH environment. That object has absolutely nothing to do with WAP or mobile telecommunications. It is a container for an object model that is fundamental to WSH. See also:
Host environment, Interpret, Platform, Script execution, WAP, WML
WScript object (Object/WSH) An object that represents the object model of the WSH framework. Availability:
JScript - 3.0
JavaScript syntax:
WSH
WScript
Object methods:
Application, Arguments, FullName, Name, Network, Path, ScriptFullName, ScriptName, StdErr, StdIn, StdOut, Version CreateObject(), DisconnectObject(), Echo(), GetObject(), Quit(), Sleep()
Property
JavaScript
JScript
N
IE
Opera
Notes
Application
-
3.0 +
-
-
-
-
Arguments
-
3.0 +
-
-
-
-
FullName
-
3.0 +
-
-
-
-
Name
-
3.0 +
-
-
-
-
Network
-
3.0 +
-
-
-
-
Object properties:
Table continued on following page
2495
Chapter number
Property
JavaScript
JScript
N
IE
Opera
Notes
Path
-
3.0 +
-
-
-
-
ScriptFullName
-
3.0 +
-
-
-
-
ScriptName
-
3.0 +
-
-
-
-
StdErr
-
3.0 +
-
-
-
-
StdIn
-
3.0 +
-
-
-
-
StdOut
-
3.0 +
-
-
-
-
Version
-
3.0 +
-
-
-
-
Method
JavaScript
JScript
N
IE
Opera
Notes
CreateObject()
-
3.0 +
-
-
-
-
DisconnectObject()
-
3.0 +
-
-
-
-
Echo()
-
3.0 +
-
-
-
-
GetObject()
-
3.0 +
-
-
-
-
Quit()
-
3.0 +
-
-
-
-
Sleep()
-
3.0 +
-
-
-
-
WScript.Application (Property) Access to the IDispatch interface for the object. Availability:
JScript - 3.0
Property/method value type:
IDispatch object
JavaScript syntax:
WSH
myApplication = WScript.Application
This mechanism describes how to gain access to the objects, properties, and methods belonging to an external application. See also:
WScript.GetObject()
WScript.Arguments (Property) This returns a collection of argument items. Availability:
JScript - 3.0
Property/method value type:
WshArguments object
JavaScript syntax:
WSH
2496
myArguments = WScript.Arguments
Error! No text of specified style in document.
The arguments are passed to the WSH script when it is executed. This collection provides a way to access the arguments, possibly by way of an enumerator. Arguments from the command line or specified by the shortcut that executed the script are passed by means of this collection.
WScript.CreateObject() (Method) Creates an instance of an automation object. Availability:
JScript - 3.0
Property/method value type:
WScript object
JavaScript syntax:
WSH
Argument list:
WSH
myObject = WScript.CreateObject(aProgID); myObject = WScript.CreateObject(aProgID, aPrefix);
aProgID
An application programme ID
aPrefix
A hook into the event model
Calling this method yields an object which can be used to communicate with another application residing in the same computer. For example, this code creates an object that references the Word application: myWord = WScript.CreateObject("Word.Application"); From here we can reference the application via the object. This makes the Word application we just instantiated visible to the user: myWord.Visible = true;
WScript.DisconnectObject() (Method) Discards an object. Availability:
JScript - 3.0
JavaScript syntax:
WSH
WScript.DisconnectObject(anObject)
Argument list:
anObject
An object previously created by WSH
This method is used to get rid of objects previously created with the CreateObject() and GetObject() methods.
2497
Chapter number
WScript.Echo() (Method) Echoes some output to the caller via standard output. Availability:
JScript - 3.0
Property/method value type:
WScript object
JavaScript syntax:
WSH
WScript.Echo(anArg)
WSH
WScript.Echo(anArg, ...)
anArg
A string or numeric value
Argument list:
This works just like the echo command in a shell scripting environment. It takes a variable number of arguments which can be strings or numbers. The behavior depends on which interpreter is being used. In the cscript interpreter, the results are concatenated together into the output stream. In the wscript interpreter, each Echo() call results in an alert() dialog box which must be manually dismissed.
WScript.FullName (Property) The full path and name for the file being executed. Availability:
JScript - 3.0
Property/method value type:
String primitive
JavaScript syntax:
WSH
myName = WScript.FullName
This property contains the full name and path for the file being executed. See also:
WScript.ScriptFullName
WScript.GetObject() (Method) Access an already existing object rather than creating a new one. Availability:
JScript - 3.0
Property/method value type:
WScript object
JavaScript syntax:
WSH
WScript.GetObject(aPath)
WSH
WScript.GetObject(aPath, aProgID)
WSH
WScript.GetObject(aPath, aProgID, aPrefix)
2498
Error! No text of specified style in document.
Argument list:
aPath
The path to an already existing document
aProgID
An application programme ID
aPrefix
A hook into the event model
You can use this method to access an object that you know already exists without needing to create a fresh instance. An example of the difference is that CreateObject() is used to manufacture new documents via the application while GetObject() is used to access existing documents. Given the object that encapsulates the document, since it is a WScript object, you can access its Application property to control the owning application. See also:
WScript.Application
WScript.Name (Property) A human readable name for the script. Availability:
JScript - 3.0
Property/method value type:
String primitive
JavaScript syntax:
WSH
myName = WScript.Name
Computers are happy to use arcane names for scripts but WSH provides a way to give your script a human-friendly name. This property returns such a value.
WScript.Network (Property) A reference to a network management object. Availability:
JScript - 3.0
Property/method value type:
WshNetwork object
JavaScript syntax:
WSH
myNet = WScript.Network
With the object returned by this property, you can manage the network within the computer, mapping in new drives or unmapping existing ones, for instance.
WScript.Path (Property) The path to the activating WSH executive. Availability:
JScript - 3.0
Property/method value type:
String primitive
JavaScript syntax:
WSH
myPath = WScript.Path
This property yields a string that describes which, of several, WSH run-time environments is used.
2499
Chapter number
WScript.Quit() (Method) Terminates the script and returns an error code. Availability:
JScript - 3.0
JavaScript syntax:
WSH
WScript.Quit(anErrCode)
Argument list:
anErrCode
An error code to be sent back to the caller
The current instance of cscript or wscript is killed and an error returned to the calling shell.
WScript.ScriptFullName (Property) The full path and script name. Availability:
JScript - 3.0
Property/method value type:
String primitive
JavaScript syntax:
WSH
myName = WScript.ScriptFullName
With this property, you can dismantle the path to the file and generate relative paths that locate temporary files adjacent to the script that is being executed. If the script is moved, the relative locations move with it. See also:
WScript.FullName
WScript.ScriptName (Property) A string containing the name of the script. Availability:
JScript - 3.0
Property/method value type:
String primitive
JavaScript syntax:
WSH
myName = WScript.ScriptName
With this property, you can create scripts that will behave differently according to the name under which they are executed.
2500
Error! No text of specified style in document.
WScript.Sleep() (Method) Suspend the script execution for a while. Availability:
JScript - 3.0
JavaScript syntax:
WSH
WScript.Sleep(aDuration)
Argument list:
aDuration
A value specified in milliseconds
With this method, you can suspend execution for a while without creating a 'busy waiting' loop.
WScript.StdErr (Property) A write-only stream used for output. Availability:
JScript - 3.0
Property/method value type:
TextStream object
JavaScript syntax:
WSH
myStream = WScript.StdErr
This is only available to WSH scripts being executed from a command line interface. It provides a way for the scripts to communicate error messages back to the caller.
WScript.StdIn (Property) A read-only stream used for input. Availability:
JScript - 3.0
Property/method value type:
TextStream object
JavaScript syntax:
WSH
myStream = WScript.StdIn
This is only available to WSH scripts being executed from a command line interface. It provides a way for the scripts to receive messages input from the caller.
2501
Chapter number
WScript.StdOut (Property) A write-only stream used for output. Availability:
JScript - 3.0
Property/method value type:
TextStream object
JavaScript syntax:
WSH
myStream = WScript.StdOut
This is only available to WSH scripts being executed from a command line interface. It provides a way for the scripts to communicate messages back to the caller.
WScript.Version (Property) A string containing the WSH version number. Availability:
JScript - 3.0
Property/method value type:
String primitive
JavaScript syntax:
WSH
myVersion = WScript.Version
With this, you can write version dependent code.
WSH (Object model) The object model used in Windows Script Host. See also:
WScript.GetObject(), WScript object
WSH (Product) Windows Script Host. See also:
.htc, Scriptlet, Web browser, Windows Script Host
wysiwyg: (Request method) Special URL method to handle page content when resized in Netscape Navigator. If a page is generated using JavaScript, then if the page is subsequently resized, this special method is used to encapsulate the previous page location and invoke special handling to ensure that the page is printed properly.
2502
X XML (Standard) Extensible Mark-up Language. This is gradually becoming commonplace as a way to exchange data between systems. It is also supported by the MSIE browser and you can load in XML documents directly. It is the future direction that HTML will evolve towards, beginning with XHTML. This topic is the entry point to complete new subject area. Its too vast to attempt to cover it meaningfully in just a few pages and yet it's probably going to become one of the most important parts of the web programming landscape. Refer to the Wrox XML reference manual for details of how to use it in earnest. Here we will just scratch the surface to begin to see what it looks like. This creates a new XML document via ActiveX: myXMLDoc = new ActiveXObject("Microsoft.XMLDOM");
Having created it, now we can load the contents of a URL into the object: myXMLDoc.load("http://xmlserver.domain.com/reports.xml");
This is useful because one big problem with JavaScript in a web browser is that it's very hard to download a data file from a web server to a script without having to work around lots of security issues. This might solve that problem a lot more elegantly. Now we can begin to look at the contents of the file and extract information from it. myXMLDoc.loadXML("JoeSmith");
Now that we have acquired the document we can use the DOM navigation techniques that already work for HTML documents to walk through the XML structures: var myXMLNodeList = myXMLDoc.getElementsByTagName(strNodeName);
Chapter number
XML name (Definition) A strict convention for naming items within an XML compliant document with a well formed token. An XML name may start with a letter, underscore or colon. However the colon is reserved for use with namespaces and is not fully standardized as of XML version 1. Subsequent characters in the name may be any one of: ❑
Letter
❑
Digit
❑
Dot (period/full stop)
❑
Dash (minus sign)
❑
Underscore
❑
Colon
❑
CombiningChar
❑
Extender
Your name values should not begin with the string "XML" or any sequence of characters that might degenerate to it after case conversion or international character substitution. Combining characters and Extenders are enumerated in Appendix B of the XML version 1.0 standard. See also:
Event.type
XML object (Object/JScript) An object that represents a block of XML page content within an HTML document. Availability:
JScript - 5.0 Internet Explorer version - 5.0
Inherits from:
Element object
JavaScript syntax:
IE
myXML = myDocument.all.anElementID
IE
myXML = myDocument.all.tags("XML")[anIndex]
IE
myXML = myDocument.all[aName]
-
myXML = myDocument.getElementById(anElementID)
myXML = myDocument.getElementsByName (aName)[anIndex] myXML = myDocument.getElementsByTagName ("XML")[anIndex] anIndex A reference to an element in a collection -
Argument list:
2504
aName
An associative array reference
anElementID
The ID value of an Element object
Error! No text of specified style in document.
Object properties:
canHaveHTML, defer, event, htmlFor, src, text, type
Event handlers:
onDataAvailable, onDatasetChanged, onDatasetComplete, onReadyStateChange, onRowEnter, onRowExit, onRowsDelete, onRowsInserted
The MSIE browser can now cope with pages delivered as arbitrary blocks of XML. If it encounters an <XML> tag, then it will instantiate one of these objects to provide JavaScript binding to it. This can also be used to build a small island of XML based content in the middle of an HTML page. The XML data can sit in an HTML page like this: <XML ID="myBlock"> <METADATA> Wrox Example This is an example block of text
Accessing the text property of the XML object will return all the inner text inside it. To access the components you will need to access the XMLDocument property to expose a DOM document interface. This can be explored using DOM compatible methods and properties. See also:
Document.readyState, onRowEnter, onRowExit
Property
JavaScript
JScript
Nav
IE
Opera
Notes
canHaveHTML
-
5.0 +
-
5.0 +
-
-
defer
-
5.0 +
-
5.0 +
-
-
event
-
5.0 +
-
5.0 +
-
-
htmlFor
-
5.0 +
-
5.0 +
-
-
src
-
5.0 +
-
5.0 +
-
-
text
-
5.0 +
-
5.0 +
-
-
type
-
5.0 +
-
5.0 +
-
-
onDataAvailable
-
3.0 +
-
4.0 +
-
-
onDatasetChanged
-
3.0 +
-
4.0 +
-
-
2505
Chapter number
Event name
JavaScript
JScript
Nav
IE
Opera
Notes
onDatasetComplete
-
3.0 +
-
4.0 +
-
-
onReadyStateChange
-
3.0 +
-
4.0 +
-
-
onRowEnter
-
3.0 +
-
4.0 +
-
-
onRowExit
-
3.0 +
-
4.0 +
-
-
onRowsDelete
-
3.0 +
-
4.0 +
-
-
onRowsInserted
-
3.0 +
-
4.0 +
-
-
Inheritance chain: Element object, Node object
Web-references: http://msdn.microsoft.com/xml/xmlguide/dom-guide-document.asp
XML.defer (Property) A property containing a deferral status for the XML block. Availability:
JScript - 5.0 Internet Explorer version - 5.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myXML.defer
This can defer the processing of an XML object until later in the page loading and display process. See also:
SCRIPT.defer
XML.event (Property) An event object associated with the XML block. Availability:
JScript - 5.0 Internet Explorer version - 5.0
Property/method value type:
Event object
JavaScript syntax:
IE
myXML.event
Events can be associated with an XML object in much the same way that they would be used with others. The model is slightly different because it is more generalised.
2506
Error! No text of specified style in document.
The Microsoft documentation lists these event handlers as being appropriate for an XML object: ❑
onDataAvailable
❑
onDatasetChanged
❑
onDatasetComplete
❑
onReadyStateChange
❑
onRowEnter
❑
onRowExit
❑
onRowsDelete
❑
onRowsInserted See also:
onDataAvailable, onDataSetChanged, onDataSetComplete, onReadyStateChange, onRowEnter, onRowExit, onRowsDelete, onRowsInserted
XML.src (Property) The URL where the contents of the XML block are to be loaded from. Availability:
JScript - 5.0 Internet Explorer version - 5.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myXML.src
You may be able to redefine this property value and reload the XML block from a different source.
XML.text (Property) The textual content of the XML block. Availability:
JScript - 5.0 Internet Explorer version - 5.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myXML.text
Any textual content will be yielded up by this property, because XML support is still evolving this property and the XML object may change. For now, you will get all the text contained within the node and its children.
2507
Chapter number
This means that for the example: <XML ID="myBlock"> <METADATA> Wrox Example This is an example block of text.
The text for the top level object will be: Wrox Example This is an example block of text. The text for the object presented by the XMLDocument property will be the same as the text for the contained <METADATA> node. The text for , and nodes will be their individual content. This means it is important to walk down the tree to the node or group of nodes you want before trying to extract the text.
XML.type (Property) The MIME type of the XML data file. Availability:
JScript - 5.0 Internet Explorer version - 5.0
Property/method value type:
String primitive
JavaScript syntax:
IE
myXML.type
The MIME type of the document associated with the XML object is accessible through the value of this property. Refer to the MIME type topic for details of the available MIME types you will likely see in this property. See also:
MIME types
XML.XMLDocument (Property) A reference to the top of a DOM hierachy that describes the content of the XML data island. Availability:
JScript - 5.0 Internet Explorer version - 5.0
JavaScript syntax:
IE
2508
myXML.XMLDocument
Error! No text of specified style in document.
Given the example of a block of XML in an HTML document: <XML ID="myBlock"> <METADATA> Wrox Example This is an example block of text.
individual nodes in that so called data island can be accessed through this XMLDocument property. The object returned by this property responds to the selectSingleNode() method. The argument to this is the slash separated path to the node within the document you are looking for. The slash separated values are the XML tagnames used to construct the document. In this example, they all begin with the string "METADATA" and since the document only contains one layer inside that, all nodes can be reached with the following strings: ❑
METADATA/OWNER
❑
METADATA/DATATYPE
❑
METADATA/ABSTRACT
Given that our XML block has an ID value of "myBlock" this line of script code should yield a reference to an object that encapsulates the node: myBlock.XMLDocument.selectSingleNode("METADATA/ABSTRACT")
Having accessed the DOM node you want, its content can be examined by looking at its text property. The example code illustrates this concept as it might be assembled together in a simple form.
Warnings: ❑
This property returns an undefined value in the Macintosh version of MSIE 5.0 instead of a reference to a DOM document.
Example code: (Comment block) (Object/HTML)
See also:
Equal to (==), Greater than (>), Greater than or equal to (>=), Identically equal to (===), Less than ( (Greater than) (Operator/relational) Compares two operands to determine which is nearer to +Infinity. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Boolean primitive
See also:
Equal to (==), Greater than (>), Greater than or equal to (>=), Identically equal to (===), Less than (), Greater than or equal to (>=), Identically equal to (===), Less than ( (Bitwise shift right) (Operator/bitwise)
Cross-references: ECMA 262 edition 2 – section – 11.8.4 ECMA 262 edition 3 – section – 11.8.4
>> (Bitwise shift right) (Operator/bitwise) Bitwise rightward shifts one operand according to another. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
See also:
Bitwise shift left (=), Bitwise unsigned shift right (>>>), Bitwise unsigned shift right and assign (>>>=), Shift operator
Cross-references: ECMA 262 edition 2 – section – 11.7.2 ECMA 262 edition 3 – section – 11.7.2
>>= (Bitwise shift right assign) (Operator/assignment) Destructively bitwise rightward shifts the first of two operands. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
2543
JavaScript Programmer's Reference
See also:
Assignment operator, Bitwise operator, Bitwise shift left (=), Bitwise unsigned shift right (>>>), Bitwise unsigned shift right and assign (>>>=), LValue
Cross-references: ECMA 262 edition 2 – section – 11.13 ECMA 262 edition 3 – section – 11.13
>>> (Bitwise unsigned shift right) (Operator/bitwise) Bitwise rightward shifts one operand according to another. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server version – 2.0 Opera – 3.0
Property/method value type:
Number primitive
See also:
Bitwise shift left (=), Bitwise unsigned shift right (>>>), Bitwise unsigned shift right and assign (>>>=), Shift operator
Cross-references: ECMA 262 edition 2 – section – 11.7.3 ECMA 262 edition 3 – section – 11.7.3
2544
Symbols – >>>= (Bitwise unsigned shift right assign) (Operator/assignment)
>>>= (Bitwise unsigned shift right assign) (Operator/assignment) Destructively bitwise rightward shifts the first of two operands. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
See also:
Assignment operator, Bitwise operator, Bitwise shift left (=), Bitwise unsigned shift right (>>>), Bitwise unsigned shift right and assign (>>>=), LValue
Cross-references: ECMA 262 edition 2 – section – 11.13 ECMA 262 edition 3 – section – 11.13
?: (Conditional block) (Operator/conditional) Conditionally executes one code branch or another. Otherwise known as the Ternary operator. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Depends on arguments
See also:
Conditionally execute (?:), if( ... ) ..., if( ... ) ... else ...
Cross-references: ECMA 262 edition 2 – section – 11.12 ECMA 262 edition 3 – section – 11.12
2545
JavaScript Programmer's Reference
@*/ (Pre-processor) The closing pre-processor directive comment delimiter. Availability:
JScript – 3.0 Internet Explorer – 4.0
JavaScript syntax:
IE
/*@someDirectives@*/
Argument list:
someDirectives
One or more directives
See also:
Pre-processing, Pre-processing – /*@ ... @*/
@ (Pre-processor) Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
User defined
Refer to: Pre-processing – @
@_alpha (Pre-processor) A pre-processor constant indicating whether the script is running in a DEC alpha workstation. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Boolean primitive
Refer to: Pre-processing – @_alpha
@_jscript (Pre-processor) A pre-processor constant indicating whether the script is executing in a JScript interpreter. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Boolean primitive
2546
Symbols – @_jscript_build (Pre-processor)
Refer to: Pre-processing – @_jscript
@_jscript_build (Pre-processor) A pre-processor constant indicating the build version of the JScript environment. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
Refer to: Pre-processing – @_jscript_build
@_jscript_version (Pre-processor) A pre-processor constant indicating the version number of the JScript interpreter. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Number primitive
Refer to: Pre-processing – @_jscript_version
@_mac (Pre-processor) A pre-processor constant indicating whether the script is running in a Macintosh workstation. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Boolean primitive
Refer to: Pre-processing – @_mac
2547
JavaScript Programmer's Reference
@_mc680x0 (Pre-processor) A pre-processor constant indicating whether the system contains a Motorola 68000 CPU. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Boolean primitive
Refer to: Pre-processing – @_mc680x0
@_PowerPC (Pre-processor) A pre-processor constant indicating whether the system contains a Motorola PowerPC CPU. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Boolean primitive
Refer to: Pre-processing – @_PowerPC
@_win16 (Pre-processor) A pre-processor constant indicating whether the script is running in a 16 bit Windows environment. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Boolean primitive
Refer to: Pre-processing – @_win16
@_win32 (Pre-processor) A pre-processor constant indicating whether the script is running in a 32 bit Windows environment. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Boolean primitive
2548
Symbols – @_x86 (Pre-processor)
Refer to: Pre-processing – @_win32
@_x86 (Pre-processor) A pre-processor constant indicating whether the system contains an Intel X-86 series CPU. Availability:
JScript – 3.0 Internet Explorer – 4.0
Property/method value type:
Boolean primitive
Refer to: Pre-processing – @_x86
@cc_on (Pre-processor) A switch to activate the pre-processor phase of the script interpreter. Availability:
JScript – 3.0 Internet Explorer – 4.0
Refer to: Pre-processing – @cc_on
@elif( ... ) ... (Pre-processor) An optional else-if pre-processor token. Availability:
JScript – 3.0 Internet Explorer – 4.0
Refer to: Pre-processing – @elif( ... ) ...
@else ... (Pre-processor) Part of the conditional code use directive. Availability:
JScript – 3.0 Internet Explorer – 4.0
2549
JavaScript Programmer's Reference
Refer to: Pre-processing – @else ...
@end (Pre-processor) Terminator for a conditional code block. Availability:
JScript – 3.0 Internet Explorer – 4.0
Refer to: Pre-processing – @end
@if( ... ) ... (Pre-processor) Conditionally includes a block of code. Availability:
JScript – 3.0 Internet Explorer – 4.0
Refer to: Pre-processing – @if( ... ) ...
@set (Pre-processor) Sets the contents of a pre-processor variable. Availability:
Refer to: Pre-processing – @set
2550
JScript – 3.0 Internet Explorer – 4.0
Symbols – [ ] (Array index) (Delimiter)
[ ] (Array index) (Delimiter) Array index delimiting tokens. Availability:
ECMAScript edition – 2 JavaScript – 1.1 JScript – 3.0 Internet Explorer – 4.0 Netscape – 3.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Depends on array content
See also:
Array index delimiter ([ ]), Property accessor
Cross-references: ECMA 262 edition 2 – section – 7.6 ECMA 262 edition 2 – section – 11.2 ECMA 262 edition 3 – section – 7.7
[ ] (Property accessor) (Delimiter) Properties can be accessed as if they were elements in an array. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0
See also:
Property accessor, Property name
Cross-references: ECMA 262 edition 2 – section – 8.6.1 ECMA 262 edition 3 – section – 8.6.1
2551
JavaScript Programmer's Reference
\ (Backslash) (Delimiter) A means of escaping a character in quoted strings and regular expressions. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server– 2.0 Opera – 3.0
Refer to: Escape sequence (\)
Cross-references: ECMA 262 edition 2 – section – 2 ECMA 262 edition 2 – section – 6 ECMA 262 edition 2 – section – 7.7.3 ECMA 262 edition 3 – section – 2 ECMA 262 edition 3 – section – 6 ECMA 262 edition 3 – section – 7.7
^ (Bitwise XOR) (Operator/bitwise) Bitwises XOR one operand with another. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
See also:
Binary bitwise operator, Bitwise XOR (^)
Cross-references: ECMA 262 edition 2 – section – 11.10 ECMA 262 edition 3 – section – 11.10
2552
Symbols – ^= (Bitwise XOR assign) (Operator/assignment)
^= (Bitwise XOR assign) (Operator/assignment) Bitwises XOR two operands and stores the result in the first. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
See also:
Assignment operator, Bitwise operator, Bitwise XOR and assign (^=), LValue
Cross-references: ECMA 262 edition 2 – section – 11.13 ECMA 262 edition 3 – section – 11.13
_ (Underscore) (Symbol) A special character allowed to be used in identifier names. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Refer to: Identifier
Cross-references: ECMA 262 edition 2 – section – 7.5 ECMA 262 edition 3 – section – 7.6
2553
JavaScript Programmer's Reference
__parent__ (Property) A Netscape special scope chain inheritance property. Availability:
JavaScript – 1.2 Netscape – 4.0
Property/method value type:
ScopeChain object
JavaScript syntax:
N
myClosure.__parent__
With the __parent__ property in Netscape, you can explicitly initialize the scope chain in your own custom functions. Using this facility is somewhat inelegant, and since it is not portable its use is likely to be fairly restricted.
Warnings: ❑
It is unclear whether this property will be added to the ECMA standard. For now it is only available in Netscape.
Example code: // Create an objectvar myObject = { aaa:"Some text" };// A fragment of script to place that object into the scope chainmyObject.__parent__ = this.__parent__;this.__parent__ = myObject;
See also:
__proto__, Lexical scoping, Scope, Scope chain
__proto__ (Property) A Netscape special prototype inheritance property. Availability:
JavaScript – 1.2 Netscape – 4.0
Property/method value type:
Function object
JavaScript syntax:
N
myClosure.__proto__
With the __proto__ property in Netscape, you can explicitly initialize the prototype inheritance chain in your own custom constructors.
2554
Symbols – ` (Backquote) (External code call)
Warnings: ❑
It is unclear whether this property will be added to the ECMA standard. For now it is only available in Netscape.
Example code: // Create a cuboid objectvar AAA = { length:100, width:200, height:300 };// Create a cuboid that shares the height valuevar BBB = { length:50, width:100, __proto__:AAA };
See also:
__parent__, Subclasses
` (Backquote) (External code call) Calls some external code during server side execution.
Refer to: Backquote (`)
{ } (Braces) (Delimiter) A delimiting token for a block of executable script source text. Availability:
See also:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0 if( ... ) ..., if( ... ) ... else ..., Code block delimiter {}
Cross-references: ECMA 262 edition 2 – section – 12.5 ECMA 262 edition 3 – section – 12.1
2555
JavaScript Programmer's Reference
| (Bitwise OR) (Operator/bitwise) Bitwises OR one operand with another. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
See also:
Binary bitwise operator, Bitwise OR (|)
Cross-references: ECMA 262 edition 2 – section – 11.10 ECMA 262 edition 3 – section – 11.10
|= (Bitwise OR assign) (Operator/assignment) Bitwises OR two operands storing the result in the first. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Number primitive
See also:
Assignment operator, Bitwise operator, Bitwise OR then assign (|=), LValue
Cross-references: ECMA 262 edition 2 – section – 11.13 ECMA 262 edition 3 – section – 11.13
2556
Symbols – || (Logical OR) (Operator/logical)
|| (Logical OR) (Operator/logical) Logical OR of two operands. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server – 2.0 Opera – 3.0
Property/method value type:
Boolean primitive
See also:
Binary logical operator, Logical OR (||)
Cross-references: ECMA 262 edition 2 – section – 11.11 ECMA 262 edition 3 – section – 11.11
~ (Bitwise NOT) (Operator/bitwise) Bitwise NOT of an operand. Availability:
ECMAScript edition – 2 JavaScript – 1.0 JScript – 1.0 Internet Explorer – 3.02 Netscape – 2.0 Netscape Enterprise Server– 2.0 Opera – 3.0
Property/method value type:
Number primitive
See also:
Bitwise NOT – complement (~), Bitwise operator, Logical NOT – complement (!), Unary expression, Unary operator
Cross-references: ECMA 262 edition 2 – section – 11.4.8 ECMA 262 edition 3 – section – 11.4.8
2557
JavaScript Programmer's Reference
! object (Object/HTML) An object representing a DTD statement tag at the front of a document. Availability:
DOM level – 1 JScript – 5.0 Internet Explorer – 5.0
Inherits from:
Element object
JavaScript syntax:
IE
myDoctype = myDocument.all.tags("!")[0]
IE
myDoctype = myDocument.all[anIndex]
IE
myDoctype = myDocument.getElementById (anElementID) myDoctype = myDocument.getElementsByName(aName) [anIndex] myDoctype = myDocument.doctype
IE IE IE HTML syntax: Argument list:
myDoctype = myDocument.getElementsByTagName("!") [anIndex]
aDocumentDescription
A reference to a DTD for this document
anIndex
A reference to an element in a collection
aName
An associative array reference
anElementID
The ID value of an Element object
Object properties:
accessKey, tabIndex
Event handlers:
onClick, onDblClick, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp
The MSIE implementation creates an object that has a constructor name that suggests its class is "!". This is very odd, and if you intend to do any work on object classes, then naming a class with what might be interpreted as a special character in the script source may lead to some problems. This is really a Doctype object and is specified in the DOM standard as a element. The recommended means of access is to retrieve the value of the doctype property of the document you want to operate on. This is normally document.doctype for the current window but in the case of multiple frames, layers or windows you may be referring to the doctype of a different document object. This object appears to inherit all of the properties of an HTML element. See also:
2558
!.tabIndex, Document.doctype, Element object, Input.accessKey
Symbols – !.tabIndex (Property)
Property
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
accessKey
-
5.0 +
-
5.0 +
-
1+
-
-
tabIndex
-
5.0 +
-
5.0 +
-
-
-
Warning
Event name
JavaScript
JScript
N
IE
Opera
DOM
HTML
Notes
onClick
-
5.0 +
-
5.0 +
-
-
4.0 +
Warning
onDblClick
-
5.0 +
-
5.0 +
-
-
4.0 +
Warning
onHelp
-
5.0 +
-
5.0 +
-
-
-
Warning
onKeyDown
-
5.0 +
-
5.0 +
-
-
4.0 +
Warning
onKeyPress
-
5.0 +
-
5.0 +
-
-
4.0 +
Warning
onKeyUp
-
5.0 +
-
5.0 +
-
-
4.0 +
Warning
onMouseDown
-
5.0 +
-
5.0 +
-
-
4.0 +
Warning
onMouseMove
-
5.0 +
-
5.0 +
-
-
4.0 +
Warning
onMouseOut
-
5.0 +
-
5.0 +
-
-
4.0 +
Warning
onMouseOver
-
5.0 +
-
5.0 +
-
-
4.0 +
Warning
onMouseUp
-
5.0 +
-
5.0 +
-
-
4.0 +
Warning
Inheritance chain: Element object, Node object
!.tabIndex (Property) A tab index for a DTD statement. Availability:
JScript – 5.0 Internet Explorer – 5.0
Property/method value type:
Number primitive
JavaScript syntax:
IE
myDTD.tabIndex
You'll likely only need to access properties of this object if you are writing 'extreme' JavaScript code. Most script writers will never encounter this object.
Warnings: ❑
This property is probably a mistake. It appeared when enumerating the properties of this object but the DTD contains no sensible tab accessible content nor is it part of a . Under tests with normal DTD values this returned a zero. See also:
! object, Document.doctype
2559
Cross Reference by Entry Type Each entry in this reference has a type or class, for example, 'object/HTML' for the A object. This cross-reference is ordered by entry type, with corresponding entries listed alphabetically beneath. The collections, events, methods and properties entry types are slightly different because they list the collection, event, method or property name first and the actual entry name (which incorporates the object name) second. Collections, events, methods and properties often have their own detailed entries, but information on browser support for them is also provided in the entry for the object to which they belong. References to both entries are listed where they exist. An asterisk is used to show which entries are in the book. Entries without an asterisk will be found on the CD only. Advice (see also Pitfall, Useful tip) Adding JavaScript to HTML Associative array indexing Bookmarklets Browser detection Browser version compatibility Character handling Color value Compatibility strategies Cookie Copying objects Debugging - client side Defensive coding E-mail containing JavaScript JavaScript Bookmark URLs JavaScript debugger console News posts containing JavaScript Obfuscation Pitfalls
ASP tag (Server side code block)
Attribute Cookie domain* Cookie expires* Cookie path* Cookie secure* Cookie value ImplicitParents* ImplicitThis*
Background (see also Definition, Overview, Standard) ECMAScript History Overview Version History
Collection all[], Document.all[] all[], Element.all[] anchors[], Document.anchors[] applets[], Document.applets[] areas[] areas[], Map.areas[] arguments[] arguments[], Function.arguments[] attributes[], Element.attributes[] attributes[], Node.attributes[] behaviorUrns[], Element.behaviorUrns[] bookmarks[], Event.bookmarks[] boundElements[], Event.boundElements[] cells[], TABLE.cells[] cells[], TR.cells[] childNodes[], Element.childNodes[] childNodes[], Node.childNodes[] children[], Element.children[] classes[], Document.classes[] controlRange[], BODY.controlRange[] cssRules[], StyleSheet.cssRules[] Drives[], FileSystem.Drives[] elements[], Form.elements[] embeds[], Document.embeds[] entities[], Doctype.entities[] Files[], Folder.Files[] filters[], Element.filters[] forms[], Document.forms[] frames[] frames[], Document.frames[] frames[], Window.frames[] ids[], Document.ids[] images[], Document.images[] imports[], StyleSheet.imports[] layers[], Document.layers[] layers[], Layer.layers[] links[], Document.links[] mimeTypes[], Navigator.mimeTypes[] notations[], Doctype.notations[] options[], Select.options[]
Collection Collection (continued) plugins[], Document.plugins[] plugins[], Navigator.plugins[] rows[], TABLE.rows[] rows[], TBODY.rows[] rows[], TFOOT.rows[] rows[], THEAD.rows[] rules[], StyleSheet.rules[] scripts[], Document.scripts[] styleSheets[], Document.styleSheets[] SubFolders[], Folder.SubFolders[] suffixes[], MimeType.suffixes[] tags[], Document.tags[] tBodies[], TABLE.tBodies[]
Constant/static Event type constants* Global.undefined Infinity* Math.E* Math.LN10* Math.LN2* Math.LOG10E* Math.LOG2E* Math.PI* Math.SQRT1_2* Math.SQRT2* NaN* Number.MAX_VALUE* Number.MIN_VALUE* Number.NaN* Number.NEGATIVE_INFINITY* Number.POSITIVE_INFINITY* undefined*
Constructor ActiveXObject() Anchor() Applet() Array() Boolean() Date() DbPool() Enumerator() Error() File() Function() Image() Layer() Lock() Number() Object() Option() RegExp() SendMail() String() VBArray()
Declaration Array literal function( ... ) ...* var*
Definition (see also Background, Overview, Standard) Accessor method Additive expression Additive operator Adornments Aggregate type Alias Anonymous code Anonymous function argc parameter Argument Argument list argv parameter Arithmetic constant Arithmetic operator Arithmetic type Array simulation Assignment expression Assignment operator Associativity Aural style sheets Automatic semi-colon insertion Basic type BeanConnect Behavior Big endian Binary bitwise operator Binary logical operator Binary operator Binding Bit Bit-field Bitwise expression Bitwise operator Bitwise shift operator Block-level tag Broken down time Browser wars Built-in function Built-in method Built-in object By reference By value Calendar time Call a function Call by reference Call by value Call-back event Calling event handlers Case Sensitivity Cast operator Category of an object CGI Driven JavaScript Character constant Character display semantics Character entity Character set Character testing Character value Class method Class variable
2561
Definition Client pull techniques Client-side JavaScript Code signing Collation sequence Color names Comma expression Comment Compatibility Completion type Compound statement Conditional expression Conditional operator Conformance Constant Constant expression Constraint Constructor function constructor property constructor.name Content Model Control character Conversion Conversion to a Boolean Conversion to a number Conversion to a string Conversion to an object Core JavaScript Core Object Cross browser compatibility Cross platform compatibility Currency symbol Custom object Data Type Date and time Date constant Daylight savings time adjustment Debugger Debugging - server side Decimal value Declaration Declared function Deep copying Definition Desktop JavaScript Developing JavaScript source code DHTML Behavior Diagnostic message Dialog boxes Digit Document component Document event handlers Domain error Double-precision Dynamic HTML Dynamic positioning Embedded JavaScript Enquiry functions Enumeration constant Environment Equality expression Equality operator Error Error events Error handling Escape sequence (\) Eval code Event
2562
Event bubbling Event handler Event handler in <SCRIPT> Event handler properties Event handler scope Event management Event model Event names Event propagation Event-driven model Exception Exception handling Executable code Execute a function Execution context Execution environment Exponent-log function Expression Expression statement File extensions Filter Floating constant Floating point Floating point arithmetic Floating point constant Flow control Form Form element Form verification Formal Parameter List Free-format language Function Function arguments Function call Function call operator ( ) Function code Function definition Function literal Function object properties Function property Function prototype Function scope Fundamental data type Furniture Garbage collection Global code Global special variable Glue code Gotcha Handler Hexadecimal value Hierarchy of objects High order bit Host environment Host features Host object HTC HTML Character entity HTML Component HTML file HTML tag attribute HyperLink Identifier Identifier resolution Identity operator Implementation Implementation-defined behavior
Definition Definition (continued) Implementation-supplied code Implementation-supplied function Implicit conversion Included JavaScript files Inheritance Initialization Inline script Inline tags Input event Input-output Instance method Instance variable Instantiating Function Integer Integer arithmetic Integer constant Integer promotion Integer-value-remainder Internal function Internal Method Internal Property Interpret Interval handlers Intrinsic events Invoke a function Iteration statement Java Java calling JavaScript Java exception events Java method calls Java method data conversion Java to JavaScript values JavaScript Document Source URL JavaScript embedded in Java JavaScript Image Source URL JavaScript Style Sheets JavaScript to Java values JellyScript JSS Jump statement Keyboard events Keyword Label Language codes Left-Hand-Side expression Length units Letter Lexical convention Lexical scoping Limits Line Line terminator List type Literal Little endian Local time Local time zone adjustment Locale-specific behavior Localization Logical constant Logical entity Logical expression Logical operator Low order bit LValue main() function
Mathematics Measurement units Member Memory allocation Memory leak Memory management Metacharacter Method MIME types Minima-maxima Money Mouse events Multi-byte character Multi-dimensional arrays Multi-line comment Multiplicative expression Multiplicative operator Namespace Native feature Native object Nondigit Not a number Null statement Number formats (.) Numerical limits Object Object constant Object literal Object model Obsolescent Octal value Operator Operator Precedence Parameter Pattern matching Platform Plugin compatibility issues Plugin events Polymorphic Portability Postfix operator Power function Precedence Preferences Prefix operator Pre-processing Primary expression Primitive value Printing character Privileges Procedural surfaces Procedure Program Property Property accessor Property attribute Property name Property value Prototype Based Inheritance Prototype chain Prototype object prototype property prototype.constructor prototype.toString() Proxies Pseudo-random numbers Punctuator
2563
Delimiter R.E. Range error Raw event Reference Reference counting Regex RegExp literal RegExp pattern RegExp pattern - alternation RegExp pattern - attributes RegExp pattern - character class RegExp pattern - character literal RegExp pattern - extension syntax RegExp pattern - grouping RegExp pattern - position RegExp pattern - references RegExp pattern - repetition RegExp pattern - sub-patterns Regular expression* Relational expression* Relational operator* Request-response loop Reserved Word Restricted access rows object RValue Scalar type Scope Scope chain Scope of event handler Script Script execution Script fragment Script Source Text Script termination Scriptlet Security policy Selection statement Semantic event Server-side JavaScript Shallow copying Shared Property Shell Scripting with JavaScript Shift expression Shift operator Side effect Single line comment Sort ordering Source files Source text Special number values Special type SSJS Standalone JavaScript Statement Static filters Static method Status line Storage duration String operator Style sheet Subclasses Superclasses Ternary operator Thousands separator Time range Timeout handlers Timer events
2564
Token Transition Translation Trigonometric function TV Set-top boxes Type Type conversion UDI Unary expression Unary operator Undefined behavior Undocumented features Unspecified behavior URI URI handling functions URL URN User-generated object Utility objects Value of an expression Value preserving Value property Variable Variable Declaration Variable instantiation Variable name Variable statement Visual filters void expression Web browser Web scripting Web server Whitespace Window adornments Window events Window feature list Window furniture XML name Zero value
Delimiter (Space) (Single quote) " (Double quote) ( ) (Argument delimiter) ( ) (Grouping operator) */ (Close comment block) . (Decimal point) . (Period) / (Slash) /* ... */ (Comment block) /*@ ... @*/ (Pre processing block) // (Comment line) : (Colon) ; (Semicolon) [ ] (Array index) [ ] (Property accessor) \ (Backslash) { } (Braces) Array index delimiter ([ ])* Braces { } Code block delimiter {}* Colon (:)* Comma operator ( Comment (// and /* ... */)* Decimal point (.)* Grouping operator ( )*
Delimiter Delimiter (continued) Object property delimiter (.)* Parentheses ( )* Pre-processing - /*@ ... @*/* Quotation mark (" and ') Semi-colon (;)*
Environment variable CLASSPATH
Escape sequence Newline*
Event handler on ... onAbort onAbort, Image object* onAbort, IMG object* onAfterPrint onAfterPrint, Dialog object* onAfterPrint, Frame object* onAfterPrint, Global object* onAfterPrint, Window object* onAfterUpdate onAfterUpdate, Applet object* onAfterUpdate, Area object* onAfterUpdate, BODY object* onAfterUpdate, Button object* onAfterUpdate, BUTTON object* onAfterUpdate, CAPTION object* onAfterUpdate, Checkbox object* onAfterUpdate, DIV object* onAfterUpdate, Document object* onAfterUpdate, FIELDSET object* onAfterUpdate, FileUpload object* onAfterUpdate, FormElement object* onAfterUpdate, Hidden object* onAfterUpdate, IMG object* onAfterUpdate, Input object* onAfterUpdate, MARQUEE object* onAfterUpdate, OBJECT object* onAfterUpdate, Password object* onAfterUpdate, RadioButton object* onAfterUpdate, ResetButton object* onAfterUpdate, Select object* onAfterUpdate, SubmitButton object* onAfterUpdate, TABLE object* onAfterUpdate, TD object* onAfterUpdate, TEXTAREA object* onAfterUpdate, TextCell object* onAfterUpdate, TH object* onBack onBeforeCopy onBeforeCut onBeforeCut, Document object* onBeforeEditFocus onBeforeEditFocus, Document object* onBeforePaste onBeforePaste, Document object* onBeforePrint onBeforePrint, Dialog object* onBeforePrint, Frame object* onBeforePrint, Global object* onBeforePrint, Window object* onBeforeUnload
onBeforeUnload, BODY object* onBeforeUnload, Dialog object* onBeforeUnload, Frame object* onBeforeUnload, FRAMESET object* onBeforeUnload, Global object* onBeforeUnload, TEXTAREA object* onBeforeUnload, TH object* onBeforeUnload, Window object* onBeforeUpdate onBeforeUpdate, Applet object* onBeforeUpdate, Area object* onBeforeUpdate, BODY object* onBeforeUpdate, Button object* onBeforeUpdate, BUTTON object* onBeforeUpdate, CAPTION object* onBeforeUpdate, Checkbox object* onBeforeUpdate, DIV object* onBeforeUpdate, Document object* onBeforeUpdate, FIELDSET object* onBeforeUpdate, FileUpload object* onBeforeUpdate, FormElement object* onBeforeUpdate, Hidden object* onBeforeUpdate, IMG object* onBeforeUpdate, Input object* onBeforeUpdate, OBJECT object* onBeforeUpdate, Password object* onBeforeUpdate, RadioButton object* onBeforeUpdate, ResetButton object* onBeforeUpdate, Select object* onBeforeUpdate, SubmitButton object* onBeforeUpdate, TABLE object* onBeforeUpdate, TD object* onBeforeUpdate, TEXTAREA object* onBeforeUpdate, TextCell object* onBlur onBlur, A object onBlur, Applet object* onBlur, Area object* onBlur, Button object* onBlur, BUTTON object* onBlur, CAPTION object* onBlur, Checkbox object* onBlur, Dialog object* onBlur, DIV object* onBlur, Embed object* onBlur, FIELDSET object* onBlur, File object* onBlur, FileUpload object* onBlur, FormElement object* onBlur, Frame object* onBlur, Global object* onBlur, Image object* onBlur, IMG object* onBlur, Input object* onBlur, Label object* onBlur, Layer object* onBlur, Legend object* onBlur, MARQUEE object* onBlur, OBJECT object* onBlur, Password object* onBlur, RadioButton object* onBlur, ResetButton object* onBlur, Select object* onBlur, SPAN object* onBlur, SubmitButton object* onBlur, TABLE object* onBlur, TD object*
2565
Event handler onBlur, TEXTAREA object* onBlur, TextCell object* onBlur, TH object* onBlur, TR object* onBlur, Window object* onBounce onBounce, MARQUEE object* onChange onChange, BODY object* onChange, CAPTION object* onChange, DIV object* onChange, FIELDSET object* onChange, FileUpload object* onChange, FormElement object* onChange, IMG object* onChange, Input object* onChange, Legend object* onChange, Password object* onChange, Select object* onChange, TEXTAREA object* onChange, TextCell object* onClick onClick, ! object* onClick, A object onClick, ABBR object onClick, ACRONYM object onClick, ADDRESS object onClick, Anchor object* onClick, Applet object* onClick, Area object* onClick, B object onClick, BASE object* onClick, BASEFONT object* onClick, BDO object* onClick, BGSOUND object* onClick, BIG object onClick, BLOCKQUOTE object* onClick, BODY object* onClick, BR object* onClick, Button object* onClick, BUTTON object* onClick, CAPTION object* onClick, CENTER object onClick, Checkbox object* onClick, CITE object onClick, CODE object onClick, COL object* onClick, COLGROUP object* onClick, DD object* onClick, DEL object* onClick, DFN object onClick, DIR object* onClick, DIV object* onClick, DL object* onClick, Document object* onClick, DT object* onClick, Element object* onClick, EM object* onClick, Embed object* onClick, FIELDSET object* onClick, File object* onClick, FONT object* onClick, Form object* onClick, FormElement object* onClick, FRAMESET object* onClick, HEAD object* onClick, H object*
2566
onClick, HR object* onClick, HTML object* onClick, HyperLink object* onClick, I object* onClick, IFRAME object* onClick, Image object* onClick, IMG object* onClick, Input object* onClick, INS object* onClick, ISINDEX object* onClick, KBD object* onClick, Label object* onClick, Legend object* onClick, LI object* onClick, LINK object* onClick, LISTING object* onClick, Location object* onClick, Map object* onClick, MARQUEE object* onClick, MENU object* onClick, META object* onClick, NOFRAMES object* onClick, NOSCRIPT object* onClick, OBJECT object* onClick, OL object* onClick, OptGroupElement object* onClick, Option object* onClick, P object* onClick, ParamElement object* onClick, PLAINTEXT object onClick, PRE object* onClick, Q object onClick, RadioButton object* onClick, ResetButton object* onClick, S object onClick, SAMP object onClick, SCRIPT object* onClick, SMALL object onClick, SPAN object* onClick, STRIKE object onClick, STRONG object* onClick, STYLE object (1)* onClick, style object (2)* onClick, SUB object onClick, SubmitButton object* onClick, SUP object onClick, TABLE object* onClick, TableColElement object* onClick, TBODY object* onClick, TD object* onClick, TextRange object* onClick, TFOOT object* onClick, TH object* onClick, THEAD object* onClick, TITLE object* onClick, TR object* onClick, TT object* onClick, U object* onClick, UL object* onClick, Url object* onClick, VAR object onContentReady onContextMenu onContextMenu, Document object* onCopy onCut onCut, Document object*
Event handler Event handler (continued) onDataAvailable onDataAvailable, Applet object* onDataAvailable, Area object* onDataAvailable, BODY object* onDataAvailable, IMG object* onDataAvailable, OBJECT object* onDataAvailable, XML object* onDataSetChanged onDataSetChanged, Applet object* onDataSetChanged, Area object* onDataSetChanged, BODY object* onDataSetChanged, IMG object* onDatasetChanged, OBJECT object* onDataSetChanged, XML object* onDataSetComplete onDataSetComplete, Applet object* onDataSetComplete, Area object* onDataSetComplete, BODY object* onDataSetComplete, IMG object* onDatasetComplete, OBJECT object* onDataSetComplete, XML object* onDblClick onDblClick, ! object* onDblClick, A object onDblClick, ABBR object onDblClick, ACRONYM object onDblClick, ADDRESS object onDblClick, Applet object* onDblClick, Area object* onDblClick, B object onDblClick, BASE object* onDblClick, BASEFONT object* onDblClick, BDO object* onDblClick, BGSOUND object* onDblClick, BIG object onDblClick, BLOCKQUOTE object* onDblClick, BODY object* onDblClick, BR object* onDblClick, Button object* onDblClick, BUTTON object* onDblClick, CAPTION object* onDblClick, CENTER object onDblClick, Checkbox object* onDblClick, CITE object onDblClick, CODE object onDblClick, COL object* onDblClick, COLGROUP object* onDblClick, DD object* onDblClick, DEL object* onDblClick, DFN object onDblClick, DIR object* onDblClick, DIV object* onDblClick, DL object* onDblClick, Document object* onDblClick, DT object* onDblClick, Element object* onDblClick, EM object* onDblClick, Embed object* onDblClick, FIELDSET object* onDblClick, File object* onDblClick, FONT object* onDblClick, Form object* onDblClick, FormElement object* onDblClick, FRAMESET object* onDblClick, HEAD object* onDblClick, H object*
onDblClick, HR object* onDblClick, HTML object* onDblClick, HyperLink object* onDblClick, I object* onDblClick, IFRAME object* onDblClick, Image object* onDblClick, IMG object* onDblClick, Input object* onDblClick, INS object* onDblClick, ISINDEX object* onDblClick, KBD object* onDblClick, Label object* onDblClick, Legend object* onDblClick, LI object* onDblClick, LINK object* onDblClick, LISTING object* onDblClick, Location object* onDblClick, Map object* onDblClick, MARQUEE object* onDblClick, MENU object* onDblClick, META object* onDblClick, NOFRAMES object* onDblClick, NOSCRIPT object* onDblClick, OBJECT object* onDblClick, OL object* onDblClick, OptGroupElement object* onDblClick, Option object* onDblClick, P object* onDblClick, ParamElement object* onDblClick, PLAINTEXT object onDblClick, PRE object* onDblClick, Q object onDblClick, RadioButton object* onDblClick, ResetButton object* onDblClick, S object onDblClick, SAMP object onDblClick, SCRIPT object* onDblClick, SMALL object onDblClick, SPAN object* onDblClick, STRIKE object onDblClick, STRONG object* onDblClick, STYLE object (1)* onDblClick, style object (2)* onDblClick, SUB object onDblClick, SubmitButton object* onDblClick, SUP object onDblClick, TABLE object* onDblClick, TableColElement object* onDblClick, TBODY object* onDblClick, TD object* onDblClick, TextRange object* onDblClick, TFOOT object* onDblClick, TH object* onDblClick, THEAD object* onDblClick, TITLE object* onDblClick, TR object* onDblClick, TT object* onDblClick, U object* onDblClick, UL object* onDblClick, Url object* onDblClick, VAR object onDocumentReady onDrag onDrag, Document object* onDragDrop onDragDrop, Dialog object* onDragDrop, Frame object*
2567
Event handler onDragDrop, Global object* onDragDrop, Window object* onDragEnd onDragEnd, Document object* onDragEnter onDragEnter, Document object* onDragLeave onDragLeave, Document object* onDragOver onDragOver, Document object* onDragStart onDragStart, ACRONYM object onDragStart, ADDRESS object onDragStart, B object onDragStart, BIG object onDragStart, BLOCKQUOTE object* onDragStart, BODY object* onDragStart, BUTTON object* onDragStart, CAPTION object* onDragStart, CENTER object onDragStart, CITE object onDragStart, CODE object onDragStart, DD object* onDragStart, DEL object* onDragStart, DFN object onDragStart, DIR object* onDragStart, DIV object* onDragStart, DL object* onDragStart, Document object* onDragStart, DT object* onDragStart, EM object* onDragStart, FIELDSET object* onDragStart, FileUpload object* onDragStart, FONT object* onDragStart, Form object* onDragStart, H object* onDragStart, HR object* onDragStart, I object* onDragStart, IMG object* onDragStart, INS object* onDragStart, KBD object* onDragStart, Label object* onDragStart, Legend object* onDragStart, LI object* onDragStart, LISTING object* onDragStart, MARQUEE object* onDragStart, MENU object* onDragStart, OBJECT object* onDragStart, OL object* onDragStart, P object* onDragStart, PLAINTEXT object onDragStart, PRE object* onDragStart, Q object onDragStart, S object onDragStart, SAMP object onDragStart, Select object* onDragStart, SMALL object onDragStart, SPAN object* onDragStart, STRIKE object onDragStart, STRONG object* onDragStart, SUB object onDragStart, SUP object onDragStart, TABLE object* onDragStart, TBODY object* onDragStart, TD object* onDragStart, TEXTAREA object* onDragStart, TFOOT object*
2568
onDragStart, TH object* onDragStart, THEAD object* onDragStart, TR object* onDragStart, TT object* onDragStart, U object* onDragStart, UL object* onDragStart, VAR object onDrop onDrop, Document object* onError onError, Dialog object* onError, Frame object* onError, Global object* onError, Image object* onError, IMG object* onError, LINK object* onError, OBJECT object* onError, SCRIPT object* onError, STYLE object (1)* onError, Window object* onErrorUpdate onErrorUpdate, Applet object* onErrorUpdate, Area object* onErrorUpdate, BODY object* onErrorUpdate, Button object* onErrorUpdate, CAPTION object* onErrorUpdate, Checkbox object* onErrorUpdate, Document object* onErrorUpdate, FIELDSET object* onErrorUpdate, OBJECT object* onErrorUpdate, RadioButton object* onErrorUpdate, TEXTAREA object* onFilterChange onFilterChange, ACRONYM object onFilterChange, ADDRESS object onFilterChange, B object onFilterChange, BIG object onFilterChange, BLOCKQUOTE object* onFilterChange, BODY object* onFilterChange, Button object* onFilterChange, BUTTON object* onFilterChange, CAPTION object* onFilterChange, CENTER object onFilterChange, Checkbox object* onFilterChange, CITE object onFilterChange, CODE object onFilterChange, DD object* onFilterChange, DEL object* onFilterChange, DFN object onFilterChange, DIR object* onFilterChange, DL object* onFilterChange, DT object* onFilterChange, EM object* onFilterChange, FIELDSET object* onFilterChange, FileUpload object* onFilterChange, FONT object* onFilterChange, Form object* onFilterChange, H object* onFilterChange, HR object* onFilterChange, I object* onFilterChange, IMG object* onFilterChange, INS object* onFilterChange, KBD object* onFilterChange, Label object* onFilterChange, Legend object* onFilterChange, LI object* onFilterChange, LISTING object*
Event handler Event handler (continued) onFilterChange, MARQUEE object* onFilterChange, MENU object* onFilterChange, OBJECT object* onFilterChange, OL object* onFilterChange, P object* onFilterChange, Password object* onFilterChange, PLAINTEXT object onFilterChange, PRE object* onFilterChange, Q object onFilterChange, RadioButton object* onFilterChange, ResetButton object* onFilterChange, S object onFilterChange, SAMP object onFilterChange, Select object* onFilterChange, SMALL object onFilterChange, SPAN object* onFilterChange, STRIKE object onFilterChange, STRONG object* onFilterChange, SUB object onFilterChange, SubmitButton object* onFilterChange, SUP object onFilterChange, TABLE object* onFilterChange, TBODY object* onFilterChange, TD object* onFilterChange, TEXTAREA object* onFilterChange, TextCell object* onFilterChange, TFOOT object* onFilterChange, TH object* onFilterChange, THEAD object* onFilterChange, TR object* onFilterChange, TT object* onFilterChange, U object* onFilterChange, UL object* onFilterChange, VAR object onFinish onFinish, MARQUEE object* onFocus onFocus, A object onFocus, Applet object* onFocus, Area object* onFocus, Button object* onFocus, BUTTON object* onFocus, CAPTION object* onFocus, Checkbox object* onFocus, Dialog object* onFocus, DIV object* onFocus, Embed object* onFocus, FIELDSET object* onFocus, File object* onFocus, FileUpload object* onFocus, FormElement object* onFocus, Frame object* onFocus, Global object* onFocus, Image object* onFocus, IMG object* onFocus, Input object* onFocus, Label object* onFocus, Layer object* onFocus, Legend object* onFocus, MARQUEE object* onFocus, OBJECT object* onFocus, Password object* onFocus, RadioButton object* onFocus, ResetButton object* onFocus, Select object* onFocus, SubmitButton object*
onFocus, TABLE object* onFocus, TEXTAREA object* onFocus, TextCell object* onFocus, Window object* onForward onHelp onHelp, ! object* onHelp, A object onHelp, ABBR object onHelp, ACRONYM object onHelp, ADDRESS object onHelp, Applet object* onHelp, Area object* onHelp, B object onHelp, BASE object* onHelp, BASEFONT object* onHelp, BDO object* onHelp, BGSOUND object* onHelp, BIG object onHelp, BLOCKQUOTE object* onHelp, BODY object* onHelp, BR object* onHelp, Button object* onHelp, BUTTON object* onHelp, CAPTION object* onHelp, CENTER object onHelp, Checkbox object* onHelp, CITE object onHelp, CODE object onHelp, COL object* onHelp, COLGROUP object* onHelp, DD object* onHelp, DEL object* onHelp, DFN object onHelp, Dialog object* onHelp, DIR object* onHelp, DIV object* onHelp, DL object* onHelp, Document object* onHelp, DT object* onHelp, Element object* onHelp, EM object* onHelp, Embed object* onHelp, FIELDSET object* onHelp, FileUpload object* onHelp, FONT object* onHelp, Form object* onHelp, FormElement object* onHelp, Frame object* onHelp, FRAMESET object* onHelp, Global object* onHelp, HEAD object* onHelp, Hidden object* onHelp, H object* onHelp, HR object* onHelp, HTML object* onHelp, HyperLink object* onHelp, I object* onHelp, IFRAME object* onHelp, Image object* onHelp, IMG object* onHelp, Input object* onHelp, INS object* onHelp, ISINDEX object* onHelp, KBD object* onHelp, Label object* onHelp, Legend object*
2569
Event handler onHelp, LI object* onHelp, LINK object* onHelp, LISTING object* onHelp, Location object* onHelp, Map object* onHelp, MARQUEE object* onHelp, MENU object* onHelp, META object* onHelp, NOFRAMES object* onHelp, NOSCRIPT object* onHelp, OBJECT object* onHelp, OL object* onHelp, OptGroupElement object* onHelp, Option object* onHelp, P object* onHelp, ParamElement object* onHelp, Password object* onHelp, PLAINTEXT object onHelp, PRE object* onHelp, Q object onHelp, RadioButton object* onHelp, ResetButton object* onHelp, S object onHelp, SAMP object onHelp, SCRIPT object* onHelp, Select object* onHelp, SMALL object onHelp, SPAN object* onHelp, STRIKE object onHelp, STRONG object* onHelp, STYLE object (1)* onHelp, style object (2)* onHelp, SUB object onHelp, SubmitButton object* onHelp, SUP object onHelp, TABLE object* onHelp, TableColElement object* onHelp, TBODY object* onHelp, TD object* onHelp, TEXTAREA object* onHelp, TextCell object* onHelp, TextRange object* onHelp, TFOOT object* onHelp, TH object* onHelp, THEAD object* onHelp, TITLE object* onHelp, TR object* onHelp, TT object* onHelp, U object* onHelp, UL object* onHelp, Url object* onHelp, VAR object onHelp, Window object* onKeyDown onKeyDown, ! object* onKeyDown, A object onKeyDown, ABBR object onKeyDown, ACRONYM object onKeyDown, ADDRESS object onKeyDown, Applet object* onKeyDown, Area object* onKeyDown, B object onKeyDown, BASE object* onKeyDown, BASEFONT object* onKeyDown, BDO object* onKeyDown, BGSOUND object* onKeyDown, BIG object
2570
onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown, onKeyDown,
BLOCKQUOTE object* BODY object* BR object* Button object* BUTTON object* CAPTION object* CENTER object Checkbox object* CITE object CODE object COL object* COLGROUP object* DD object* DEL object* DFN object DIR object* DIV object* DL object* Document object* DT object* Element object* EM object* Embed object* FIELDSET object* FileUpload object* FONT object* Form object* FormElement object* FRAMESET object* HEAD object* H object* HR object* HTML object* HyperLink object* I object* IFRAME object* Image object* IMG object* Input object* INS object* ISINDEX object* KBD object* Label object* Legend object* LI object* LINK object* LISTING object* Location object* Map object* MARQUEE object* MENU object* META object* NOFRAMES object* NOSCRIPT object* OBJECT object* OL object* OptGroupElement object* Option object* P object* ParamElement object* Password object* PLAINTEXT object PRE object* Q object RadioButton object* ResetButton object* S object
Event handler Event handler (continued) onKeyDown, SAMP object onKeyDown, SCRIPT object* onKeyDown, Select object* onKeyDown, SMALL object onKeyDown, SPAN object* onKeyDown, STRIKE object onKeyDown, STRONG object* onKeyDown, STYLE object (1)* onKeyDown, style object (2)* onKeyDown, SUB object onKeyDown, SubmitButton object* onKeyDown, SUP object onKeyDown, TABLE object* onKeyDown, TableColElement object* onKeyDown, TBODY object* onKeyDown, TD object* onKeyDown, TEXTAREA object* onKeyDown, TextCell object* onKeyDown, TextRange object* onKeyDown, TFOOT object* onKeyDown, TH object* onKeyDown, THEAD object* onKeyDown, TITLE object* onKeyDown, TR object* onKeyDown, TT object* onKeyDown, U object* onKeyDown, UL object* onKeyDown, Url object* onKeyDown, VAR object onKeyPress onKeyPress, ! object* onKeyPress, A object onKeyPress, ABBR object onKeyPress, ACRONYM object onKeyPress, ADDRESS object onKeyPress, Applet object* onKeyPress, Area object* onKeyPress, B object onKeyPress, BASE object* onKeyPress, BASEFONT object* onKeyPress, BDO object* onKeyPress, BGSOUND object* onKeyPress, BIG object onKeyPress, BLOCKQUOTE object* onKeyPress, BODY object* onKeyPress, BR object* onKeyPress, Button object* onKeyPress, BUTTON object* onKeyPress, CAPTION object* onKeyPress, CENTER object onKeyPress, Checkbox object* onKeyPress, CITE object onKeyPress, CODE object onKeyPress, COL object* onKeyPress, COLGROUP object* onKeyPress, DD object* onKeyPress, DEL object* onKeyPress, DFN object onKeyPress, DIR object* onKeyPress, DIV object* onKeyPress, DL object* onKeyPress, Document object* onKeyPress, DT object* onKeyPress, Element object* onKeyPress, EM object* onKeyPress, Embed object*
onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress, onKeyPress,
FIELDSET object* FileUpload object* FONT object* Form object* FormElement object* FRAMESET object* HEAD object* H object* HR object* HTML object* HyperLink object* I object* IFRAME object* Image object* IMG object* Input object* INS object* ISINDEX object* KBD object* Label object* Legend object* LI object* LINK object* LISTING object* Location object* Map object* MARQUEE object* MENU object* META object* NOFRAMES object* NOSCRIPT object* OBJECT object* OL object* OptGroupElement object* Option object* P object* ParamElement object* Password object* PLAINTEXT object PRE object* Q object RadioButton object* ResetButton object* S object SAMP object SCRIPT object* Select object* SMALL object SPAN object* STRIKE object STRONG object* STYLE object (1)* style object (2)* SUB object SubmitButton object* SUP object TABLE object* TableColElement object* TBODY object* TD object* TEXTAREA object* TextCell object* TextRange object* TFOOT object* TH object* THEAD object* TITLE object*
2571
Event handler onKeyPress, TR object* onKeyPress, TT object* onKeyPress, U object* onKeyPress, UL object* onKeyPress, Url object* onKeyPress, VAR object onKeyUp onKeyUp, ! object* onKeyUp, A object onKeyUp, ABBR object onKeyUp, ACRONYM object onKeyUp, ADDRESS object onKeyUp, Applet object* onKeyUp, Area object* onKeyUp, B object onKeyUp, BASE object* onKeyUp, BASEFONT object* onKeyUp, BDO object* onKeyUp, BGSOUND object* onKeyUp, BIG object onKeyUp, BLOCKQUOTE object* onKeyUp, BODY object* onKeyUp, BR object* onKeyUp, Button object* onKeyUp, BUTTON object* onKeyUp, CAPTION object* onKeyUp, CENTER object onKeyUp, Checkbox object* onKeyUp, CITE object onKeyUp, CODE object onKeyUp, COL object* onKeyUp, COLGROUP object* onKeyUp, DD object* onKeyUp, DEL object* onKeyUp, DFN object onKeyUp, DIR object* onKeyUp, DIV object* onKeyUp, DL object* onKeyUp, Document object* onKeyUp, DT object* onKeyUp, Element object* onKeyUp, EM object* onKeyUp, Embed object* onKeyUp, FIELDSET object* onKeyUp, FileUpload object* onKeyUp, FONT object* onKeyUp, Form object* onKeyUp, FormElement object* onKeyUp, FRAMESET object* onKeyUp, HEAD object* onKeyUp, H object* onKeyUp, HR object* onKeyUp, HTML object* onKeyUp, HyperLink object* onKeyUp, I object* onKeyUp, IFRAME object* onKeyUp, Image object* onKeyUp, IMG object* onKeyUp, Input object* onKeyUp, INS object* onKeyUp, ISINDEX object* onKeyUp, KBD object* onKeyUp, Label object* onKeyUp, Legend object* onKeyUp, LI object* onKeyUp, LINK object* onKeyUp, LISTING object*
2572
onKeyUp, Location object* onKeyUp, Map object* onKeyUp, MARQUEE object* onKeyUp, MENU object* onKeyUp, META object* onKeyUp, NOFRAMES object* onKeyUp, NOSCRIPT object* onKeyUp, OBJECT object* onKeyUp, OL object* onKeyUp, OptGroupElement object* onKeyUp, Option object* onKeyUp, P object* onKeyUp, ParamElement object* onKeyUp, Password object* onKeyUp, PLAINTEXT object onKeyUp, PRE object* onKeyUp, Q object onKeyUp, RadioButton object* onKeyUp, ResetButton object* onKeyUp, S object onKeyUp, SAMP object onKeyUp, SCRIPT object* onKeyUp, Select object* onKeyUp, SMALL object onKeyUp, SPAN object* onKeyUp, STRIKE object onKeyUp, STRONG object* onKeyUp, STYLE object (1)* onKeyUp, style object (2)* onKeyUp, SUB object onKeyUp, SubmitButton object* onKeyUp, SUP object onKeyUp, TABLE object* onKeyUp, TableColElement object* onKeyUp, TBODY object* onKeyUp, TD object* onKeyUp, TEXTAREA object* onKeyUp, TextCell object* onKeyUp, TextRange object* onKeyUp, TFOOT object* onKeyUp, TH object* onKeyUp, THEAD object* onKeyUp, TITLE object* onKeyUp, TR object* onKeyUp, TT object* onKeyUp, U object* onKeyUp, UL object* onKeyUp, Url object* onKeyUp, VAR object onLoad onLoad, Applet object* onLoad, Area object* onLoad, Dialog object* onLoad, Frame object* onLoad, FRAMESET object* onLoad, Global object* onLoad, Image object* onLoad, IMG object* onLoad, Layer object* onLoad, LINK object* onLoad, SCRIPT object* onLoad, STYLE object (1)* onLoad, Window object* onLoseCapture onMouseDown onMouseDown, ! object* onMouseDown, A object
Event handler Event handler (continued) onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown,
ABBR object ACRONYM object ADDRESS object Anchor object* Applet object* Area object* B object BASE object* BASEFONT object* BDO object* BGSOUND object* BIG object BLOCKQUOTE object* BODY object* BR object* Button object* BUTTON object* CAPTION object* CENTER object Checkbox object* CITE object CODE object COL object* COLGROUP object* DD object* DEL object* DFN object DIR object* DIV object* DL object* Document object* DT object* Element object* EM object* Embed object* FIELDSET object* FileUpload object* FONT object* Form object* FormElement object* FRAMESET object* HEAD object* H object* HR object* HTML object* HyperLink object* I object* IFRAME object* Image object* IMG object* Input object* INS object* ISINDEX object* KBD object* Label object* Legend object* LI object* LINK object* LISTING object* Location object* Map object* MARQUEE object* MENU object* META object* NOFRAMES object* NOSCRIPT object*
onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDown, onMouseDrag onMouseMove onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove,
OBJECT object* OL object* OptGroupElement object* Option object* P object* ParamElement object* Password object* PLAINTEXT object PRE object* Q object RadioButton object* ResetButton object* S object SAMP object SCRIPT object* Select object* SMALL object SPAN object* STRIKE object STRONG object* STYLE object (1)* style object (2)* SUB object SubmitButton object* SUP object TABLE object* TableColElement object* TBODY object* TD object* TEXTAREA object* TextCell object* TextRange object* TFOOT object* TH object* THEAD object* TITLE object* TR object* TT object* U object* UL object* Url object* VAR object
! object* A object ABBR object ACRONYM object ADDRESS object Applet object* Area object* B object BASE object* BASEFONT object* BDO object* BGSOUND object* BIG object BLOCKQUOTE object* BODY object* BR object* Button object* BUTTON object* CAPTION object* CENTER object Checkbox object* CITE object CODE object
2573
Event handler onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove, onMouseMove,
2574
COL object* COLGROUP object* DD object* DEL object* DFN object Dialog object* DIR object* DIV object* DL object* Document object* DT object* Element object* EM object* Embed object* FIELDSET object* FileUpload object* FONT object* Form object* FormElement object* Frame object* FRAMESET object* HEAD object* H object* HR object* HTML object* HyperLink object* I object* IFRAME object* Image object* IMG object* Input object* INS object* ISINDEX object* KBD object* Label object* Legend object* LI object* LINK object* LISTING object* Location object* Map object* MARQUEE object* MENU object* META object* NOFRAMES object* NOSCRIPT object* OBJECT object* OL object* OptGroupElement object* Option object* P object* ParamElement object* Password object* PLAINTEXT object PRE object* Q object RadioButton object* ResetButton object* S object SAMP object SCRIPT object* Select object* SMALL object SPAN object* STRIKE object STRONG object* STYLE object (1)*
onMouseMove, style object (2)* onMouseMove, SUB object onMouseMove, SubmitButton object* onMouseMove, SUP object onMouseMove, TABLE object* onMouseMove, TableColElement object* onMouseMove, TBODY object* onMouseMove, TD object* onMouseMove, TEXTAREA object* onMouseMove, TextCell object* onMouseMove, TextRange object* onMouseMove, TFOOT object* onMouseMove, TH object* onMouseMove, THEAD object* onMouseMove, TITLE object* onMouseMove, TR object* onMouseMove, TT object* onMouseMove, U object* onMouseMove, UL object* onMouseMove, Url object* onMouseMove, VAR object onMouseMove, Window object* onMouseOut onMouseOut, ! object* onMouseOut, A object onMouseOut, ABBR object onMouseOut, ACRONYM object onMouseOut, ADDRESS object onMouseOut, Anchor object* onMouseOut, Applet object* onMouseOut, Area object* onMouseOut, B object onMouseOut, BASE object* onMouseOut, BASEFONT object* onMouseOut, BDO object* onMouseOut, BGSOUND object* onMouseOut, BIG object onMouseOut, BLOCKQUOTE object* onMouseOut, BODY object* onMouseOut, BR object* onMouseOut, Button object* onMouseOut, BUTTON object* onMouseOut, CAPTION object* onMouseOut, CENTER object onMouseOut, Checkbox object* onMouseOut, CITE object onMouseOut, CODE object onMouseOut, COL object* onMouseOut, COLGROUP object* onMouseOut, DD object* onMouseOut, DEL object* onMouseOut, DFN object onMouseOut, DIR object* onMouseOut, DIV object* onMouseOut, DL object* onMouseOut, Document object* onMouseOut, DT object* onMouseOut, Element object* onMouseOut, EM object* onMouseOut, Embed object* onMouseOut, FIELDSET object* onMouseOut, FileUpload object* onMouseOut, FONT object* onMouseOut, Form object* onMouseOut, FormElement object* onMouseOut, FRAMESET object* onMouseOut, HEAD object*
Event handler Event handler (continued) onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut, onMouseOut,
H object* HR object* HTML object* HyperLink object* I object* IFRAME object* Image object* IMG object* Input object* INS object* ISINDEX object* KBD object* Label object* Layer object* Legend object* LI object* LINK object* LISTING object* Location object* Map object* MARQUEE object* MENU object* META object* NOFRAMES object* NOSCRIPT object* OBJECT object* OL object* OptGroupElement object* Option object* P object* ParamElement object* Password object* PLAINTEXT object PRE object* Q object RadioButton object* ResetButton object* S object SAMP object SCRIPT object* Select object* SMALL object SPAN object* STRIKE object STRONG object* STYLE object (1)* style object (2)* SUB object SubmitButton object* SUP object TABLE object* TableColElement object* TBODY object* TD object* TEXTAREA object* TextCell object* TextRange object* TFOOT object* TH object* THEAD object* TITLE object* TR object* TT object* U object* UL object*
onMouseOut, Url object* onMouseOut, VAR object onMouseOver onMouseOver, ! object* onMouseOver, A object onMouseOver, ABBR object onMouseOver, ACRONYM object onMouseOver, ADDRESS object onMouseOver, Anchor object* onMouseOver, Applet object* onMouseOver, Area object* onMouseOver, B object onMouseOver, BASE object* onMouseOver, BASEFONT object* onMouseOver, BDO object* onMouseOver, BGSOUND object* onMouseOver, BIG object onMouseOver, BLOCKQUOTE object* onMouseOver, BODY object* onMouseOver, BR object* onMouseOver, Button object* onMouseOver, BUTTON object* onMouseOver, CAPTION object* onMouseOver, CENTER object onMouseOver, Checkbox object* onMouseOver, CITE object onMouseOver, CODE object onMouseOver, COL object* onMouseOver, COLGROUP object* onMouseOver, DD object* onMouseOver, DEL object* onMouseOver, DFN object onMouseOver, DIR object* onMouseOver, DIV object* onMouseOver, DL object* onMouseOver, Document object* onMouseOver, DT object* onMouseOver, Element object* onMouseOver, EM object* onMouseOver, Embed object* onMouseOver, FIELDSET object* onMouseOver, FileUpload object* onMouseOver, FONT object* onMouseOver, Form object* onMouseOver, FormElement object* onMouseOver, FRAMESET object* onMouseOver, HEAD object* onMouseOver, H object* onMouseOver, HR object* onMouseOver, HTML object* onMouseOver, HyperLink object* onMouseOver, I object* onMouseOver, IFRAME object* onMouseOver, Image object* onMouseOver, IMG object* onMouseOver, Input object* onMouseOver, INS object* onMouseOver, ISINDEX object* onMouseOver, KBD object* onMouseOver, Label object* onMouseOver, Layer object* onMouseOver, Legend object* onMouseOver, LI object* onMouseOver, LINK object* onMouseOver, LISTING object* onMouseOver, Location object* onMouseOver, Map object*
2575
Event handler onMouseOver, MARQUEE object* onMouseOver, MENU object* onMouseOver, META object* onMouseOver, NOFRAMES object* onMouseOver, NOSCRIPT object* onMouseOver, OBJECT object* onMouseOver, OL object* onMouseOver, OptGroupElement object* onMouseOver, Option object* onMouseOver, P object* onMouseOver, ParamElement object* onMouseOver, Password object* onMouseOver, PLAINTEXT object onMouseOver, PRE object* onMouseOver, Q object onMouseOver, RadioButton object* onMouseOver, ResetButton object* onMouseOver, S object onMouseOver, SAMP object onMouseOver, SCRIPT object* onMouseOver, Select object* onMouseOver, SMALL object onMouseOver, SPAN object* onMouseOver, STRIKE object onMouseOver, STRONG object* onMouseOver, STYLE object (1)* onMouseOver, style object (2)* onMouseOver, SUB object onMouseOver, SubmitButton object* onMouseOver, SUP object onMouseOver, TABLE object* onMouseOver, TableColElement object* onMouseOver, TBODY object* onMouseOver, TD object* onMouseOver, TEXTAREA object* onMouseOver, TextCell object* onMouseOver, TextRange object* onMouseOver, TFOOT object* onMouseOver, TH object* onMouseOver, THEAD object* onMouseOver, TITLE object* onMouseOver, TR object* onMouseOver, TT object* onMouseOver, U object* onMouseOver, UL object* onMouseOver, Url object* onMouseOver, VAR object onMouseUp onMouseUp, ! object* onMouseUp, A object onMouseUp, ABBR object onMouseUp, ACRONYM object onMouseUp, ADDRESS object onMouseUp, Anchor object* onMouseUp, Applet object* onMouseUp, Area object* onMouseUp, B object onMouseUp, BASE object* onMouseUp, BASEFONT object* onMouseUp, BDO object* onMouseUp, BGSOUND object* onMouseUp, BIG object onMouseUp, BLOCKQUOTE object* onMouseUp, BODY object* onMouseUp, BR object* onMouseUp, Button object* onMouseUp, BUTTON object*
2576
onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp, onMouseUp,
CAPTION object* CENTER object Checkbox object* CITE object CODE object COL object* COLGROUP object* DD object* DEL object* DFN object DIR object* DIV object* DL object* Document object* DT object* Element object* EM object* Embed object* FIELDSET object* FileUpload object* FONT object* Form object* FormElement object* FRAMESET object* HEAD object* H object* HR object* HTML object* HyperLink object* I object* IFRAME object* Image object* IMG object* Input object* INS object* ISINDEX object* KBD object* Label object* Layer object* Legend object* LI object* LINK object* LISTING object* Location object* Map object* MARQUEE object* MENU object* META object* NOFRAMES object* NOSCRIPT object* OBJECT object* OL object* OptGroupElement object* Option object* P object* ParamElement object* Password object* PLAINTEXT object PRE object* Q object RadioButton object* ResetButton object* S object SAMP object SCRIPT object* Select object* SMALL object
Event handler Event handler (continued) onMouseUp, SPAN object* onMouseUp, STRIKE object onMouseUp, STRONG object* onMouseUp, STYLE object (1)* onMouseUp, style object (2)* onMouseUp, SUB object onMouseUp, SubmitButton object* onMouseUp, SUP object onMouseUp, TABLE object* onMouseUp, TableColElement object* onMouseUp, TBODY object* onMouseUp, TD object* onMouseUp, TEXTAREA object* onMouseUp, TextCell object* onMouseUp, TextRange object* onMouseUp, TFOOT object* onMouseUp, TH object* onMouseUp, THEAD object* onMouseUp, TITLE object* onMouseUp, TR object* onMouseUp, TT object* onMouseUp, U object* onMouseUp, UL object* onMouseUp, Url object* onMouseUp, VAR object onMove onMove, Dialog object* onMove, Frame object* onMove, Global object* onMove, Window object* onPaste onPaste, Document object* onPropertyChange onPropertyChange, Document object* onReadyStateChange onReadyStateChange, Applet object* onReadyStateChange, Area object* onReadyStateChange, Document object* onReadyStateChange, LINK object* onReadyStateChange, OBJECT object* onReadyStateChange, SCRIPT object* onReadyStateChange, STYLE object (1)* onReadyStateChange, XML object* onReset onReset, Form object* onResize onResize, Applet object* onResize, Area object* onResize, BUTTON object* onResize, Dialog object* onResize, DIV object* onResize, FIELDSET object* onResize, FileUpload object* onResize, Frame object* onResize, FRAMESET object* onResize, Global object* onResize, IMG object* onResize, MARQUEE object* onResize, Password object* onResize, Select object* onResize, TABLE object* onResize, TD object* onResize, TH object* onResize, Window object* onRowEnter onRowEnter, Applet object*
onRowEnter, Area object* onRowEnter, BODY object* onRowEnter, Button object* onRowEnter, BUTTON object* onRowEnter, Checkbox object* onRowEnter, DIV object* onRowEnter, Document object* onRowEnter, FileUpload object* onRowEnter, FormElement object* onRowEnter, Hidden object* onRowEnter, IMG object* onRowEnter, Input object* onRowEnter, MARQUEE object* onRowEnter, OBJECT object* onRowEnter, Password object* onRowEnter, RadioButton object* onRowEnter, ResetButton object* onRowEnter, Select object* onRowEnter, SubmitButton object* onRowEnter, TABLE object* onRowEnter, TD object* onRowEnter, TEXTAREA object* onRowEnter, TextCell object* onRowEnter, TH object* onRowEnter, XML object* onRowExit onRowExit, Applet object* onRowExit, Area object* onRowExit, BODY object* onRowExit, Button object* onRowExit, BUTTON object* onRowExit, Checkbox object* onRowExit, DIV object* onRowExit, Document object* onRowExit, FileUpload object* onRowExit, FormElement object* onRowExit, Hidden object* onRowExit, IMG object* onRowExit, Input object* onRowExit, MARQUEE object* onRowExit, OBJECT object* onRowExit, Password object* onRowExit, RadioButton object* onRowExit, ResetButton object* onRowExit, Select object* onRowExit, SubmitButton object* onRowExit, TABLE object* onRowExit, TD object* onRowExit, TEXTAREA object* onRowExit, TextCell object* onRowExit, TH object* onRowExit, XML object* onRowsDelete onRowsDelete, XML object* onRowsInserted onRowsInserted, XML object* onScroll onScroll, BODY object* onScroll, CAPTION object* onScroll, Dialog object* onScroll, DIV object* onScroll, FIELDSET object* onScroll, Frame object* onScroll, IMG object* onScroll, Legend object* onScroll, MARQUEE object* onScroll, TABLE object*
2577
Filter/transition onScroll, TEXTAREA object* onScroll, Window object* onSelect onSelect, CAPTION object* onSelect, FIELDSET object* onSelect, FileUpload object* onSelect, FormElement object* onSelect, Input object* onSelect, Password object* onSelect, TEXTAREA object* onSelect, TextCell object* onSelectStart onSelectStart, A object onSelectStart, ACRONYM object onSelectStart, ADDRESS object onSelectStart, B object onSelectStart, BIG object onSelectStart, BLOCKQUOTE object* onSelectStart, BODY object* onSelectStart, BUTTON object* onSelectStart, CAPTION object* onSelectStart, CENTER object onSelectStart, CITE object onSelectStart, CODE object onSelectStart, DD object* onSelectStart, DEL object* onSelectStart, DFN object onSelectStart, DIR object* onSelectStart, DIV object* onSelectStart, DL object* onSelectStart, Document object* onSelectStart, DT object* onSelectStart, EM object* onSelectStart, FIELDSET object* onSelectStart, FileUpload object* onSelectStart, FONT object* onSelectStart, Form object* onSelectStart, H object* onSelectStart, HR object* onSelectStart, I object* onSelectStart, IMG object* onSelectStart, INS object* onSelectStart, KBD object* onSelectStart, Label object* onSelectStart, Legend object* onSelectStart, LI object* onSelectStart, LISTING object* onSelectStart, MARQUEE object* onSelectStart, MENU object* onSelectStart, OBJECT object* onSelectStart, OL object* onSelectStart, P object* onSelectStart, Password object* onSelectStart, PLAINTEXT object onSelectStart, PRE object* onSelectStart, Q object onSelectStart, S object onSelectStart, SAMP object onSelectStart, Select object* onSelectStart, SMALL object onSelectStart, SPAN object* onSelectStart, STRIKE object onSelectStart, STRONG object* onSelectStart, SUB object onSelectStart, SUP object onSelectStart, TABLE object* onSelectStart, TBODY object*
2578
onSelectStart, TD object* onSelectStart, TEXTAREA object* onSelectStart, TFOOT object* onSelectStart, TH object* onSelectStart, THEAD object* onSelectStart, TR object* onSelectStart, TT object* onSelectStart, U object* onSelectStart, UL object* onSelectStart, VAR object onStart onStart, MARQUEE object* onStop onStop, Document object* onSubmit onSubmit, Form object* onUnload onUnload, BODY object* onUnload, Dialog object* onUnload, Frame object* onUnload, FRAMESET object* onUnload, Global object* onUnload, Window object*
External code call ` (Backquote) Backquote (`)*
File extension (see also Special file) .cfg .cgi .htc* .htm .html .jar* .java* .js* .jsc .jse .jsh .lck .pac* .shtm .shtml .stm .web
Filter/blend BlendTrans() filter - BlendTrans()*
Filter/procedural filter - AlphaImageLoader()* filter - Gradient()*
Filter/reveal filter - RevealTrans()* RevealTrans()
Filter/transition Barn() Blinds()
Filter/transition Filter/transition (continued) CheckerBoard() Fade() filter - Barn()* filter - Blinds()* filter - CheckerBoard()* filter - Fade()* filter - GradientWipe()* filter - Inset()* filter - Iris()* filter - Pixelate()* filter - RadialWipe()* filter - RandomBars()* filter - RandomDissolve()* filter - Slide()* filter - Spiral()* filter - Stretch()* filter - Strips()* filter - Wheel()* filter - Zigzag()* GradientWipe() Inset() Iris() Pixelate() RadialWipe() RandomBars() RandomDissolve() Slide() Spiral() Stretch() Strips() Wheel() Zigzag()
Filter/visual Alpha() AlphaImageLoader() BasicImage() Blur() Chroma() Compositor() DropShadow() Emboss() Engrave() filter - Alpha()* filter - BasicImage()* filter - Blur()* filter - Chroma()* filter - Compositor()* filter - DropShadow()* filter - Emboss()* filter - Engrave()* filter - FlipH()* filter - FlipV()* filter - Glow()* filter - Grayscale()* filter - Invert()* filter - Light()* filter - Mask()* filter - MaskFilter()* filter - Matrix()* filter - MotionBlur()* filter - Pixelate()* filter - Shadow()* filter - Wave()* filter - XRay()*
FlipH() FlipV() Glow() Gradient() Grayscale() Invert() Light() Mask() MaskFilter() Matrix() MotionBlur() Pixelate() Shadow() Wave() XRay()
Function abs()*, Math.abs()* acos()*, Math.acos()* Array()* asin()*, Math.asin()* atan()*, Math.atan()* atan2()*, Math.atan2()* atob()*, Window.atob()* Boolean()* btoa()*, Window.btoa()* captureEvents()* captureEvents()*, Document.captureEvents()* captureEvents()*, Layer.captureEvents()* captureEvents()*, Window.captureEvents()* catch( ... )* ceil()*, Math.ceil()* cos()*, Math.cos()* Date()* decodeURI()* decodeURIComponent()* encodeURI()* encodeURIComponent()* Error()* exp()*, Math.exp()* floor()*, Math.floor()* Function()* getClass() GetObject()* handleEvent()* handleEvent()*, Document.handleEvent()* handleEvent()*, Layer.handleEvent()* handleEvent()*, Window.handleEvent()* Image() log()*, Math.log()* max()*, Math.max()* min()*, Math.min()* Number()* Object()* pow()*, Math.pow()* random(), Crypto.random() random()*, Math.random()* RegExp() releaseEvents() releaseEvents()*, Document.releaseEvents()* releaseEvents()*, Layer.releaseEvents()* releaseEvents()*, Window.releaseEvents()* rgb()* round()*, Math.round()*
2579
Java package routeEvent() routeEvent(), Document.routeEvent() routeEvent()*, Layer.routeEvent()* routeEvent()*, Window.routeEvent()* ScriptEngine()* signText(), Crypto.signText() sin()*, Math.sin()* sqrt()*, Math.sqrt()* String()* tan()*, Math.tan()*
<SCRIPT SRC="...">* <SCRIPT TYPE="...">* <STYLE TYPE="...">* * HTTP-EQUIV="..." ID="..."* LANG="..."* MAYSCRIPT* NAME="..."
Interface Function/global escape()* eval()* isFinite()* isNaN()* parseFloat()* parseInt()* ScriptEngineBuildVersion()* ScriptEngineMajorVersion() ScriptEngineMinorVersion() taint()* toString()* unescape()* untaint()* unwatch()* watch()*
Function/internal Call* CanPut()* DefaultValue()* Delete()* Get()* GetBase()* GetPropertyName()* GetValue()* HasInstance()* HasProperty()* Put()* PutValue()*
Function/proxy.pac FindProxyForURL()* isInNet()* isPlainHostName()*
HTML Tag <EMBED>* <META>* * <SCRIPT>* <STYLE>* <TITLE>* Conditional comment* HTML Comment tag ( (Comment block) A object ABBR object ACRONYM object ADDRESS object Anchor object* Applet object* Area object* B object BASE object* BASEFONT object* BDO object* BGSOUND object* BIG object BLOCKQUOTE object* BODY object* BR object* BUTTON object* CAPTION object* CENTER object CITE object CODE object COL object* COLGROUP object* DD object* DEL object* DFN object DIR object* DIV object* DL object* Document object* DT object* Element object* EM object* Embed object* FIELDSET object* FONT object*
2595
Object/NES Form object* FRAMESET object* H object* HEAD object* HR object* HTML object* HyperLink object* I object* IFRAME object* Image object* IMG object* INS object* ISINDEX object* KBD object* Label object* Legend object* LI object* LINK object* LISTING object* Map object* MARQUEE object* MENU object* META object* NOFRAMES object* NOSCRIPT object* OBJECT object* OL object* OptGroupElement object* Option object* P object* ParamElement object* PLAINTEXT object PRE object* Q object RT object RUBY object* S object SAMP object SCRIPT object* Select object* SMALL object SPAN object* STRIKE object STRONG object* STYLE object (1)* SUB object SUP object TABLE object* TableColElement object* TBODY object* TD object* TFOOT object* TH object* THEAD object* TITLE object* TR object* TT object* U object* UL object* Url object* VAR object XMP object
Object/internal Activation object Call object Closure object*
2596
Object/JScript ActiveXObject object* Automation object clipboardData object* currentStyle object* dataTransfer object* Dialog object* Dictionary object* Drive object* Drives object* Enumerator object* external object* File object* Files object* FileSystem object* Filter object* Filters object Folder object* Folders object* runtimeStyle object* TextRange object* textRectangle object* TextStream object* userProfile object* VBArray object* vCard object* XML object*
Object/JSS JSSClasses object* JSSTag object* JSSTags object*
Object/Navigator Bar object* Clip object* Closure()* Crypto object* EventCapturer object* JavaArray object* JavaClass object* JavaMethod object JavaObject object* JavaPackage object* Layer object* LayerArray object* Pkcs11 object* Sidebar object*
Object/NES blob object* client object* Connection object* Cursor object* database object* DbPool object* File object* Lock object* project object* request object* response object* ResultSet object* SendMail object* server object* Stproc object*
Object/WSH Object/WSH WScript object*
Operator/additive - (Minus) + (Add) Add (+)* Minus (-) Subtract (-)*
Operator/assignment %= (Modulo assign) &= (Bitwise AND assign) *= (Multiply assign) /= (Divide assign) ^= (Bitwise XOR assign) |= (Bitwise OR assign) += (Add assign) = (Bitwise shift right assign) >>>= (Bitwise unsigned shift right assign) Add then assign (+=)* Assign value (=)* Bitwise AND then assign (&=)* Bitwise OR then assign (|=)* Bitwise shift left then assign (=)* Bitwise unsigned shift right and assign (>>>=)* Bitwise XOR and assign (^=)* Concatenate then assign (+=)* Divide then assign (/=)* Minus then assign (-=) Multiply then assign (*=)* Remainder then assign (%=)* Subtract then assign (-=)*
Operator/bitwise & (Bitwise AND) ^ (Bitwise XOR) | (Bitwise OR) ~ (Bitwise NOT) > (Bitwise shift right) >>> (Bitwise unsigned shift right) Bitwise AND (&)* Bitwise NOT - complement (~)* Bitwise OR (|)* Bitwise shift left ()* Bitwise unsigned shift right (>>>)* Bitwise XOR (^)* Left shift Right shift
Operator/identity !== (NOT identical) === (Identical to) Exactly equal to (===) Identically equal to (===)* NOT Identically equal to (!==)* Strictly equal to (===)
Operator/internal ToBoolean* ToInt32* ToInteger* ToNumber* ToObject* ToPrimitive* ToString* ToUint16* ToUint32*
Operator/logical ! (Logical NOT) && (Logical AND) || (Logical OR) in* instanceof* Logical AND (&&)* Logical NOT - complement (!)* Logical OR (||)* Logical XOR*
Operator/multiplicative % (Modulo/remainder) * (Multiply) / (Divide) Divide (/)* Modulo Multiply (*)* Remainder (%)*
Operator/postfix -- (Post decrement) ++ (Post increment) Decrement value (--)* Increment value (++)* Postfix decrement (--)* Postfix expression* Postfix increment (++)*
Operator/prefix -- (Pre decrement) ++ (Pre increment) Prefix decrement (--)* Prefix expression* Prefix increment (++)*
Operator/conditional ?: (Conditional block) Conditionally execute (?:)*
Operator/equality != (NOT equal) == (Equal to) Equal to (==)* NOT Equal to (!=)*
Operator/relational < (Less than) (Greater than) >= (Greater than or equal to) Greater than (>)* Greater than or equal to (>=)* Less than (