JavaScript Programmer’s Reference This keyword also represents a Java data type and the char keyword allows for the potential extension of JavaScript interfaces to access Java applet parameters and return values. byte, java.lang.Character, LiveConnect, Reserved word See also: Cross-references: ECMA 262 edition 2 section 7.4.3 ECMA 262 edition 3 section 7.5.2 Character constant (Definition) A literal description of a single character. String primitive Property/method value type: A character constant in JavaScript is represented by a single character length String primitive. Technically it is a string, not a character. In JavaScript the single quote delimiter encloses strings as well as the double quote delimiter. Beware of this if you are familiar with C language character constants. In C, the single quote (apostrophe) is used to enclose a single character that can be represented by a byte. Some character constant escape codes are listed in the following table: Escape Sequence: Name: Symbol: ” Double Quote ” ‘ Single Quote (Apostrophe) ‘ \ Backslash a Audible alert (MSIE displays the letter a) b Backspace (ignored silently in MSIE) f Form Feed (ignored silently in MSIE) n Line Feed (Newline - MSIE inserts a space) r Carriage Return (MSIE inserts a space) t Horizontal Tab (MSIE inserts a space) v Vertical tab (MSIE displays the letter v) nn Octal escape - 42 Double Quote ” 47 Single Quote (Apostrophe) ‘ 134 Backslash xnn Hexadecimal escape - Table continued on following page #BREAK# C Character display semantics (Definition) Escape Sequence: Name: Symbol: x22 Double Quote ” x27 Single Quote (Apostrophe) ‘ x5C Backslash unnnn Unicode escape - u0022 Double Quote ” u0027 Single Quote (Apostrophe) ‘ u005C Backslash uFFFE A special Unicode sentinel character for flagging byte reversed text - uFFFF A special Unicode sentinel character - See also: Character handling, Constant, Constant expression, Escape sequence (), Literal, Primitive value Character display semantics (Definition) How characters are displayed on the implementation’s console. Although the standard defines many escape sequences (see table), how these are displayed depends very much on the way that the implementation uses the output of JavaScript: Escape Sequence: Name: Symbol: ” Double Quote ” ‘ Single Quote (Apostrophe) ‘ \ Backslash a Audible alert (MSIE displays the letter a) b Backspace (ignored silently in MSIE) f Form Feed (ignored silently in MSIE) n Line Feed (Newline - MSIE inserts a space) r Carriage Return (MSIE inserts a space) t Horizontal Tab (MSIE inserts a space) v Vertical tab (MSIE displays the letter v) nn Octal escape - 42 Double Quote ” 47 Single Quote (Apostrophe) ‘ 134 Backslash xnn Hexadecimal escape - x22 Double Quote ” x27 Single Quote (Apostrophe) ‘ Table continued on following page #BREAK# JavaScript Programmer’s Reference Escape Sequence: Name: Symbol: x5C Backslash unnnn Unicode escape - u0022 Double Quote ” u0027 Single Quote (Apostrophe) ‘ u005C Backslash uFFFE A special Unicode sentinel character for flagging byte-reversed text - uFFFF A special Unicode sentinel character - Encoding line feeds, form feeds, and tabs into data that ultimately gets output as part of a document.write() method suggests that the target is an HTML page. When HTML is rendered, any embedded tabs and line terminators have no effect at all on the displayed output apart from some undesirable side effects in older browsers, which used to display line terminators inside anchor tags in a very odd way. On the other hand, JavaScript that is generating a text data stream that is going to be returned via a TCP socket may well want to encode all kinds of escaped control characters. Warnings: . Generally a browser will ignore any escape sequences it cannot cope with. Some it will ignore silently such as a bwhich results in no output in the MSIE browser. For others, such as a, MSIE ignores the backslash but writes the letter ‘a’ into the document output. A few escape characters result in a space character being inserted into the output text. . You should, as a matter of course, clean your HTML text of any unwanted escape characters if you can. Character set, Environment, Escape sequence () See also: Character entity (Definition) A means of escaping difficult-to-type characters for use in HTML. Refer to: HTML Character entity Character handling (Advice) Functions for testing character attributes. Developers who use the C language and who are converting to JavaScript may be used to having support for testing various properties of character codes. These functions are not formally part of the JavaScript language, although some of them are provided as part of the host environment through additional objects that provide C-like functionality. These are modeled on the Math object and cannot usually be instantiated by belonging to the Global object in the same way as the Math object does. #BREAK# C Character set (Definition) ScriptEase by Nombas is one interpreter that provides support for C language functionality through its Clib object. If you are using other interpreters, you can simulate these character handling functions with fragments of script and some bitwise operators. The following functions that are normally available to C programmers are simulated with the script examples in the following sections: . isalnum() . isalpha() . iscntrl() . isdigit() . isgraph() . islower() . isprint() . ispunct() . isspace() . isupper() . isxdigit() See also: isAlnum(), isAlpha(), isCtrl(), isDigit(), isGraph(), isLower(), isODigit(), isPrint(), isPunct(), isSpace(), isUpper(), isXDigit() Character set (Definition) The collection of characters that the script can operate on. Since JavaScript 1.3 and JScript 3.0, the language has been built around the Unicode standard. This means its identifiers and hence its script source code is intended to be represented by a sequence of Unicode characters. The benefit of this is that identifiers can be named using international characters. The reality is that some implementations don’t support this very well, even if they can parse and process Unicode correctly as data. As is the case with many languages, there may be a character set that can be used for data and a smaller sub-set that is valid for use when editing script source text. Strictly speaking, a JavaScript script source can be encoded with 7 bit ASCII characters since there are mechanisms to escape generated character codes that are multi-byte Unicode code points. The Unicode standard describes a large number of international character sets in terms of the character glyphs supported by them. There are also a large number of ISO standardized character sets. See also: ASCII, Character display semantics, Character handling, Character-case mapping, Environment, Escape sequence (), isLower(), isUpper(), Locale-specific behavior, Localization, Multi-byte character, Unicode #BREAK# JavaScript Programmer’s Reference Character testing (Definition) Testing characters for attributes. The following functions that are normally available to C programmers are simulated with script examples in the following sections: . isalnum() . isalpha() . iscntrl() . isdigit() . isgraph() . islower() . isprint() . ispunct() . isspace() . isupper() . isxdigit() Strictly speaking, these functions should be coded to be aware of locale-specific issues. You may want to take example simulations provided here and modify them to your own needs to support that. These are just basic working examples. Character handling, Character-case mapping, isAlnum(), isAlpha(), isCtrl(), isDigit(), isGraph(), isLower(), isODigit(), isPrint(), isPunct(), isSpace(), isUpper(), isXDigit(), String.charAt(), String.charCodeAt(), String.fromCharCode() See also: Character value (Definition) A numeric value based on the Unicode and ASCII character code points. ASCII, Integer constant, Unicode See also: Character-case mapping (Overview) Character case conversion. The conversion of characters from upper to lower case and vice versa is accomplished in JavaScript by means of the String object. This provides two methods that can be applied to a String object to change its case. However, this would not work on String primitives so you may need to do an object conversion first. #BREAK# C CharacterData object (Object/DOM) The ECMAScript standard mandates that only the base characters need be mapped between the upper and lower case. Sorting and case conversion may support other international characters in some implementations, but this is not covered by the standard. Localization issues may affect this sort of operation. The interpreter should automatically convert any String primitives to String objects so that the method can be applied. This means that this should work: “aaaa”.toUpperCase() And you should not need to do this: String(”aaaa”).toUpperCase() See also: ASCII, Character handling, Character set, Character testing, isLower(), isUpper(), Locale-specific behavior, String.charCodeAt(), String.fromCharCode(), String.toLocaleLowerCase(), String.toLocaleUpperCase(), String.toLowerCase(), String.toUpperCase(), Unicode CharacterData object (Object/DOM) A sub-class of the nodeobject with extensions to support access to character data within the object. Availability: DOM level 1 JavaScript 1.5 JScript 5.0 Internet Explorer 5.0 Netscape 6.0 Inherits from: Node object JavaScript syntax: -myCharacterData = new CharacterData() Object properties: data, length Object methods: appendData(), deleteData(), insertData(), replaceData(), substringData() COMMENT object See also: Property JavaScript JScript N IE Opera DOM Notes data 1.5 + 5.0 + 6.0 + 5.0 + 1 + - length 1.5 + 5.0 + 6.0 + 5.0 + 1 + - Method JavaScript JScript N IE Opera DOM Notes appendData() 1.5 + 5.0 + 6.0 + 5.0 + 1 + - deleteData() 1.5 + 5.0 + 6.0 + 5.0 + 1 + - insertData() 1.5 + 5.0 + 6.0 + 5.0 + 1 + - replaceData() 1.5 + 5.0 + 6.0 + 5.0 + 1 + - substringData() 1.5 + 5.0 + 6.0 + 5.0 + 1 + - #BREAK# JavaScript Programmer’s Reference Inheritance chain: Node object CharacterData.appendData() (Method) Append some text to the end of the character data. Availability: DOM level 1 JavaScript 1.5 JScript 5.0 Internet Explorer 5.0 Netscape 6.0 JavaScript syntax: -myCharacterData.appendData(aString) Argument list: aString Some data to append CharacterData.data (Property) The current contents of the character data node. 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: -myCharacterData.data CharacterData.deleteData() (Method) Remove a section of text from the data contained in the character data node. Availability: DOM level 1 JavaScript 1.5 JScript 5.0 Internet Explorer 5.0 Netscape 6.0 JavaScript syntax: -myCharacterData.deleteData(anOffset, aCount) anOffset The start of the deleted section Argument list: aCount The length of the deleted section #BREAK# C CharacterData.insertData() (Method) CharacterData.insertData() (Method) Insert some additional text into the character data node. Availability: DOM level 1 JavaScript 1.5 JScript 5.0 Internet Explorer 5.0 Netscape 6.0 JavaScript syntax: -myCharacterData.insertData(anOffset, aString) anOffset A location to insert the data at Argument list: aString The data to insert CharacterData.length (Property) Return the length (in characters) of the character data node. Availability: DOM level 1 JavaScript 1.5 JScript 5.0 Internet Explorer 5.0 Netscape 6.0 Property/method value type: Number primitive JavaScript syntax: -myCharacterData.length CharacterData.replaceData() (Method) Replace a section of text in the character data node with some new text. Availability: DOM level 1 JavaScript 1.5 JScript 5.0 Internet Explorer 5.0 Netscape 6.0 JavaScript syntax: -myCharacterData.replaceData(anOffset, aCount, aString) anOffset The location where the replacement starts aCount The length of data to be replaced Argument list: aString The new data to insert #BREAK# JavaScript Programmer’s Reference CharacterData.substringData() (Method) Availability: Property/method value type: JavaScript syntax: Argument list: Checkbox object (Object/DOM) A checkbox to be used in a form. It toggles as it is clicked, but is not related to other checkboxes in the way that radio buttons are related to one another in families. Non destructively extract a section of the text from the character data node. DOM level 1 JavaScript 1.5 JScript 5.0 Internet Explorer 5.0 Netscape 6.0 String primitive -myCharacterData.substringData(anOffset, aCount) anOffset A location where the substring starts aCount The length of the substring Availability: DOM level 1 JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Opera 3.0 Inherits from: Input object -myCheckbox = myDocument.aFormName.anElementName -myCheckbox = myDocument.aFormName.elements[anItemIndex] IE myCheckbox = myDocument.all.anElementID IE myCheckbox = myDocument.all.tags(”INPUT”)[anIndex] IE myCheckbox = myDocument.all[aName] -myCheckbox = myDocument.forms[aFormIndex].anElementName -myCheckbox = myDocument.forms[aFormIndex].elements [anItemIndex] -myCheckbox = myDocument.getElementById(anElementID) -myCheckbox = myDocument.getElementsByName(aName)[anIndex] JavaScript syntax: -myCheckbox = myDocument.getElementsByTagName(”INPUT”) [anIndex] #BREAK# C Checkbox object (Object/DOM) HTML syntax: anIndex A valid reference to an item in the collection aName The nameattribute of an element anElementID The ID attribute of an element anItemIndex A valid reference to an item in the collection Argument list: aFormIndex A reference to a particular form in the forms collection Object properties: checked, defaultChecked, indeterminate, status, type, value Object methods: handleEvent() Event handlers: onAfterUpdate, onBeforeUpdate, onBlur, onClick, onDblClick, onErrorUpdate, onFilterChange, onFocus, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onRowEnter, onRowExit Many properties, methods, and event handlers are inherited from the Input object class. Refer to topics grouped with the “Input” prefix for details of common functionality across all sub-classes of the Input object super-class. There isn’t really a Checkboxobject class but it is helpful when trying to understand the wide variety of input element types if we can reduce the complexity by discussing only the properties and methods of a checkbox. In actual fact, the object is represented as an item of the Input object class. Checkboxes may be used in groups where each one has the same name. However, this breaks the mechanism by which a form element can be accessed associatively since there is now more than one object with the same name. The fix for this is to support an InputArray so that you can access the items with the same name from a collection. Although Checkbox items should not deactivate other items in the same family in the way that Radio buttons do, you can relate their states to one another by means of the onclick event handler. Unlike MSIE, Netscape does not support the defaultValue property or the select() method for this sub-class of the Input object. Warnings: . If you enumerate a formobject that has several elements having the same name, in Netscape these will be represented by a single property of that name that refers to an InputArray. In MSIE, you will get multiple properties with the same name, but each will refer to a collection object. This is probably a bug in MSIE, which exhibits this behavior in version 5 for Macintosh and probably on other platforms too. . Note that on MSIE, Inputobjects are actually INPUT objects because MSIE follows a general rule of naming object classes after the capitalised name of the HTML tag that instantiates them. #BREAK# JavaScript Programmer’s Reference Example code:
?
See also: Element object, Form.elements[], FormElement object, Input object, Input.accessKey, onClick Property JavaScript JScript N IE Opera DOM HTML Notes checked 1.0 + 1.0 + 2.0 + 3.02 + 3.0 + 1 + - defaultChecked 1.0 + 1.0 + 2.0 + 3.02 + 3.0 + 1 + - indeterminate 3.0 + 4.0 + - status 3.0 + 4.0 + Warning type 1.1 + 1.0 + 3.0 + 3.02 + 3.0 + 1 + -ReadOnly value 1.0 + 1.0 + 2.0 + 3.02 + 3.0 + 1 + Warning Method JavaScript JScript N IE Opera DOM HTML Notes handleEvent() 1.2 + 4.0 + - Event name JavaScript JScript N IE Opera DOM HTML Notes onAfterUpdate 3.0 + 4.0 + - onBeforeUpdate 3.0 + 4.0 + - onBlur 1.1 + 3.0 + 3.0 + 4.0 + 3.0 + Warning onClick 1.0 + 3.0 + 2.0 + 4.0 + 3.0 + 4.0 + Warning onDblClick 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + 4.0 + Warning #BREAK# C Checkbox.checked (Property) Event name JavaScript JScript N IE Opera DOM HTML Notes onErrorUpdate 3.0 + 4.0 + - onFilterChange 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 + 2.0 + 4.0 + 3.0 + 4.0 + Warning onMouseUp 1.2 + 3.0 + 4.0 + 4.0 + 3.0 + 4.0 + Warning onRowEnter 3.0 + 4.0 + - onRowExit 3.0 + 4.0 + - Inheritance chain: Element object, Input object, Node object Checkbox.checked (Property) The state of the checkbox is maintained in 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: Boolean primitive JavaScript syntax: -myCheckbox.checked HTML syntax: If the checkbox has a mark in it (depending on the UI display appearance guidelines, this may be a tick or a cross), then this value will return true. Otherwise it will return false. #BREAK# JavaScript Programmer’s Reference Checkbox.defaultChecked (Property) The original initial default state of a checkbox. Availability: DOM level 1 JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Opera 3.0 Property/method value type: Boolean primitive JavaScript syntax: -myCheckbox.defaultChecked HTML syntax: The defaultCheckedstate of an Input item is the value that was defined in the HTML document source when the page was loaded. You can use this value if you need to reset the status of a page or determine whether the user has changed the settings on an input item since the page was loaded. Checkbox.handleEvent() (Method) Pass an event to the appropriate handler for this object. Availability: JavaScript 1.2 Netscape 4.0 Property/method value type: undefined JavaScript syntax: N myResetButton.handleEvent(anEvent) Argument list: anEvent An event to be handled by this object This applies to Netscape prior to version 6.0. From that release onwards, event management follows the guidelines in the DOM level 3 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 Eventobject that contains information about the event. handleEvent() See also: #BREAK# C Checkbox.indeterminate (Property) Checkbox.indeterminate (Property) A checkbox is in this state if it was selected, but then disabled. The state cannot be accurately and unambiguously determined. Availability: JScript 3.0 Internet Explorer 4.0 Property/method value type: Boolean primitive JavaScript syntax: IE myCheckbox.indeterminate Checkboxes may be enabled and disabled. If you have a checkbox that was enabled and then checked, and then if it is subsequently disabled, this flag property is set to true which indicates that the current state of the checkbox is indeterminate. Checkbox.status (Property) The current highlighted or checked status of the input element. Availability: JScript 3.0 Internet Explorer 4.0 Property/method value type: Boolean primitive JavaScript syntax: IE myCheckbox.status This is the current status of the checkbox item. It is either checked or not. If the checkbox has not been changed since the page was loaded from the server, then this value will be the same as the defaultChecked property of the checkbox. Warnings: . Because this is not supported on all browsers, you should use the Checkbox.checked property instead if portable code is important to your project. Checkbox.type (Property) The type value for the tag that describes the form checkbox. DOM level 1 JavaScript 1.1 JScript 1.0 Internet Explorer 3.02 Netscape 3.0 Opera 3.0 String primitive Availability: Property/method value type: #BREAK# JavaScript Programmer’s Reference JavaScript syntax: -myCheckbox.type HTML syntax: The typevalue for a checkbox is always “checkbox”. This value is necessary to determine the type of form element because this object is really an instance of the Input class and not the Checkbox class. There is actually no Checkbox class. Input.type See also: Property attributes: ReadOnly. Checkbox.value (Property) The text string for this particular checkbox object. 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 JavaScript syntax: -myCheckbox.value HTML syntax: This value is returned to the server during a submit only if the checked state for this radio button is on. Warnings: . If the checkbox is used in a group or even if it isn’t, the state of the checkbox is in the checked property not the value property. See also: Input.value CheckerBoard() (Filter/transition) A transition effect with the appearance of chequer board blinds opening or closing. Availability: JScript - 5.5 Internet Explorer - 5.5 Refer to: filter -CheckerBoard() #BREAK# C ChildNodes object (Object/DOM) ChildNodes object (Object/DOM) A collection of all the children belonging to a DOM Node object. Availability: DOM level 1 JavaScript 1.5 JScript 5.0 Internet Explorer 5.0 Netscape 6.0 JavaScript syntax: -myChildNodes = myElement.childNodes This is part of the internal DOM hierarchy model in the browser. There are several tree hierarchies supported and this one maintains a tree of parent-child node relationships across the document. Element object, Element.childNodes[], Hierarchy of objects See also: Chroma() (Filter/visual) A visual filter for chroma key effects. Availability: JScript 3.0 Internet Explorer 4.0 Refer to: Filter - Chroma() CITE 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 IE myCITE = myDocument.all.anElementID IE myCITE = myDocument.all.tags(”CITE”)[anIndex] IE myCITE = myDocument.all[aName] -myCITE = myDocument.getElementById(anElementID) -myCITE = myDocument.getElementsByName(aName)[anIndex] JavaScript syntax: -myCITE = myDocument.getElementsByTagName(”CITE”)[anIndex] HTML syntax: … anElementID The ID value of the element required anIndex A valid reference to an item in the collection Argument list: aName The nameattribute of an element #BREAK# JavaScript Programmer’s Reference onClick, onDblClick, onDragStart, onFilterChange, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onSelectStart Event handlers: Event name JavaScript JScript N IE Opera DOM HTML Notes onClick -3.0 + -4.0 + 3.0 + 4.0 + Warning onDblClick -3.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 -3.0 + -4.0 + 3.0 + 4.0 + Warning onKeyPress -3.0 + -4.0 + 3.0 + 4.0 + Warning onKeyUp -3.0 + -4.0 + 3.0 + 4.0 + Warning onMouseDown -3.0 + -4.0 + 3.0 + 4.0 + Warning onMouseMove -3.0 + -4.0 + 4.0 + Warning onMouseOut -3.0 + -4.0 + 3.0 + 4.0 + Warning onMouseOver -3.0 + -4.0 + 3.0 + 4.0 + Warning onMouseUp -3.0 + -4.0 + 3.0 + 4.0 + Warning onSelectStart 3.0 + 4.0 + - Inheritance chain: Element object, Node object Refer to: Element object Class (Property/internal) Internal property that returns an object class. ECMAScript edition 2 Availability: This internal property returns a string value containing the class name of the containing object. Every object type must implement this property. It is supported by all built-in native objects in an ECMA-compliant JavaScript interpreter. Host objects may supply any value as a Class identifying string. They may even masquerade as one of the built-in classes, but good sense suggests that if they do, then they must obey the protocol of that built-in class in precisely the same way as if they were a real built-in object. It’s probably sensible for host implementers to avoid overloading the built-in class names like that. #BREAK# C class (Reserved word) At edition 2 of the ECMA standard, there is no publicly accessible method to retrieve this property in a script. However, the reserved keyword values suggest that this may be offered at a later revision of the standard. See also: Array.Class, Boolean.Class, class, Date.Class, Function.Class, Internal Property, Number.Class, Object.Class, Reserved word, String.Class Property attributes: Internal. Cross-references: ECMA 262 edition 2 section 8.6.2 ECMA 262 edition 3 section 8.6.2 class (Reserved word) Reserved for future language enhancements. Although you cannot request the class of a particular object, you can probably establish what class it belongs to with the typeof operator. This keyword also represents a Java object type and the class keyword allows for the potential extension of JavaScript interfaces to access Java applet parameters and return values. See also: Class, Internal Property, java.lang.Class, LiveConnect, Reserved word, typeof Cross-references: ECMA 262 edition 2 section 7.4.3 ECMA 262 edition 2 section 11.4.3 ECMA 262 edition 3 section 7.5.3 ECMA 262 edition 3 section 11.4.3 Class method (Definition) Methods owned by a constructor function object. Refer to: Static method #BREAK# JavaScript Programmer’s Reference Class variable (Definition) Static variables owned by a constructor function object. Property See also: Refer to: Static variable CLASS=”…” (HTML Tag Attribute) A means of associating a tag with a stylesheet class. Represented by the className property of an Element object. DOM level 1 JavaScript 1.5 JScript 3.0 Internet Explorer 4.0 Netscape 6.0 Availability: In MSIE, virtually any object can be associated with a style object by means of the CLASS attribute. This is reflected into the className property of the object. It is especially applicable to DOM-related objects, which are considered to be sub-classed from the Element object. Netscape 6.0 brings that browser into line with these capabilities. See also: DOM, Element object, Element.className, Element.style, STYLE object (1), style object (2) classes (Property) An alternative reference to the document.classes property in JSS. JavaScript 1.2 Netscape 4.0 Deprecated Netscape 6.0 Collection object classes N Availability: Property/method value type: JavaScript syntax: N myDocument.classes Warnings: .This functionality is removed from Netscape 6.0. See also: JavaScript Style Sheets, Document.classes[] #BREAK# C CLASSPATH (Environment variable) CLASSPATH (Environment variable) This is an important environment variable that helps Java code locate resources on your system. It needs to be set correctly. Java, LiveConnect See also: clearInterval() (Method) Cancel a previous setInterval() timer. myWindow.clearInterval(anIntervalID) - The ID of an interval returned by the anIntervalID Argument list: setInterval() method Availability: JavaScript 1.2 JScript 3.0 Internet Explorer 4.0 Netscape 4.0 Property/method value type: undefined -clearInterval(anIntervalID)JavaScript syntax: See also: Window.clearTimeout(), Window.clearInterval() clearTimeout() (Method) A function that removes a pending timeout event. myWindow.clearTimeout(aTimeoutID) - The ID of a timeout returned by the aTimeoutID Argument list: setTimeout() method Availability: JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Opera 3.0 Property/method value type: undefined -clearTimeout(aTimeoutID)JavaScript syntax: #BREAK# JavaScript Programmer’s Reference Warnings: . This can cause problems if the timeout event you have identified has already been executed. Pending timeouts quite reasonably can be removed. Already executed timeout actions cannot be removed and may crash the browser if you try to remove them. Be sure that you are really removing a pending timeout. . A better technique is to set flags in global variables and use them to inhibit the creation of a new timeout event if you are using this for a kind of interval timer. See also: Window.clearTimeout(), Window.setTimeout() client object (Object/NES) A server-side object available in NES. client Availability: JavaScript 1.1 Netscape Enterprise Server 2.0 JavaScript syntax: NES client HTML syntax: Object methods: destroy(), expiration() One client object is created for each browser user. It is created when the user first accesses the NES application and persists until some time after they have last visited. A timeout allows the server to garbage-collect these sessionobjects and purge them out. If a client comes back again later, a new object will need to be created. Because there is no sessionobject in Netscape Enterprise Server, this object serves the purpose of maintaining session state as well as holding details of the client. To maintain state across all session in an application, you should use the project object discussed in a separate topic. Client objects have a limited lifetime. It is configurable but typically they will expire and be discarded after 10 minutes of inactivity. See also: Netscape Enterprise Server, project object, response.client, unwatch(), watch() Method JavaScript JScript NES Notes destroy() 1.1 + 2.0 + - expiration() 1.1 + 2.0 + - #BREAK# C client.destroy() (Method) client.destroy() (Method) This destroys the client object. Availability: JavaScript 1.1 Netscape Enterprise Server 2.0 JavaScript syntax: NES client.destroy() Calling this method on a client object will remove it and if the user makes another request, a new client object will have to be created. This is slightly inconsistent with the normal way that objects are destroyed. Normally the delete operator would be used. client.expiration() (Method) This method will define the timeout after which the client object will expire. Used to set the life-span of a client object in an NES server. Availability: JavaScript 1.1 Netscape Enterprise Server 2.0 JavaScript syntax: NES client.expiration(aTime) Argument list: aTime A time value measured in seconds This method allows the number of seconds before a session times out to be defined. After this time, the client object will be purged automatically and if the user connects again after that, a new client object will need to be created. The expiration time can be set for individual clientobjects. You may have one that needs to persist longer based on the kind of session the user is experiencing. For example, it might be useful to expire an e-commerce session quickly to prevent misuse. A content administrator may need a session to be active for a much longer time than usual. Typical expiry time for this sort of thing would be about 30 minutes. This is in line with current practice of log analysis techniques and log auditing. Breaks of more than 30 minutes are considered to be multiple sessions. Client pull techniques (Definition) This is a technique whereby the client end pulls content from the server at regular intervals. Refer to: Timer events #BREAK# JavaScript Programmer’s Reference Client-side JavaScript (Definition) The JavaScript that gets executed in the web browser or other client application. See also: .jar, .java, .js, Desktop JavaScript, HTML file, Server-side JavaScript, Web browser Cross-references: Wrox Instant JavaScript page 3 Wrox Instant JavaScript page 5 clientInformation (Property) Details of the browser, A.K.A. the navigator object. Availability: JScript 3.0 Internet Explorer 4.0 Property/method value type: Navigator object IE clientInformation JavaScript syntax: IE myWindow.clientInformation See also: Cross platform compatibility, Navigator object, Window.clientInformation, Window.navigator Property attributes: ReadOnly, DontEnum. Clip object (Object/Navigator) An object that represents a clip region within a layer. JavaScript 1.2 Netscape 4.0 Deprecated Netscape 6.0 Availability: N myClip = myLayer.clip N myClip = myStyle.clip N myClip = myTextRectangle JavaScript syntax: N myClip = myRect Object properties: bottom, height, left, right, top, width #BREAK# C Clip.bottom (Property) This object represents a clipping rectangle that the visible part of a display object is viewed through. This is most likely used with a layer object. The layer contents would be drawn off-screen and then that part that falls within the clipping rectangle would be displayed in the window. This can be useful for performing wipes and making parts of a layer progressively visible within some kind of transition loop. In the MSIE browser, these rectangular objects are manufactured as needed with the rect() constructor function. Warnings: . No longer supported in Netscape 6.0. See also: Layer.clip, Rect object, style.clip, textRectangle object Property JavaScript JScript N IE Opera Notes bottom 1.2 + 4.0 + Warning, Deprecated height 1.2 + 4.0 + Warning, Deprecated left 1.2 + 4.0 + Warning, Deprecated right 1.2 + 4.0 + Warning, Deprecated top 1.2 + 4.0 + Warning, Deprecated width 1.2 + 4.0 + Warning, Deprecated Clip.bottom (Property) The bottom of a layer clip region. Availability: JavaScript 1.2 Netscape 4.0 Deprecated Netscape 6.0 Property/method value type: Number primitive JavaScript syntax: N myClip.bottom This defines the bottom edge of the clip region. You could modify this in a loop to create a vertical downwards wipe transition effect. Warnings: . No longer supported in Netscape 6.0. Layer.clip.bottom, Rect.bottom See also: #BREAK# JavaScript Programmer’s Reference Clip.height (Property) The height of a layer clip region. JavaScript 1.2 Netscape 4.0 Deprecated Netscape 6.0 myClip.height Availability: Property/method value type: JavaScript syntax: N Number primitive The clip region is defined by an extent rectangle that surrounds the space occupied by the clip region. An extent rectangle is the smallest rectangle that completely encloses the item. This property specifies the height of that extent rectangle. Warnings: . No longer supported in Netscape 6.0. See also: Layer.clip.height, Rect.height Clip.left (Property) The left of a layer clip region. JavaScript 1.2 Netscape 4.0 Deprecated Netscape 6.0 myClip.left Availability: Property/method value type: JavaScript syntax: N Number primitive This defines the left edge of the clip region. You could modify this in a loop to create a horizontal wipe transition effect. Warnings: . No longer supported in Netscape 6.0. See also: Layer.clip.left, Rect.left Clip.right (Property) The right of a layer clip region. JavaScript 1.2 Netscape 4.0 Deprecated Netscape 6.0 Availability: #BREAK# C Clip.top (Property) Property/method value type: JavaScript syntax: myClip.right N Number primitive This defines the right edge of the clip region. You could modify this in a loop to create a horizontal wipe transition effect. Warnings: . No longer supported in Netscape 6.0. See also: Layer.clip.right, Rect.right Clip.top (Property) The top of a layer clip region. JavaScript 1.2 Netscape 4.0 Deprecated Netscape 6.0 myClip.top Availability: Property/method value type: JavaScript syntax: N Number primitive This defines the top edge of the clip region. You could modify this in a loop to create a vertical downwards wipe transition effect. Warnings: . No longer supported in Netscape 6.0. See also: Layer.clip.top, Rect.top Clip.width (Property) The width of a layer clip region. JavaScript 1.2 Netscape 4.0 Deprecated Netscape 6.0 myClip.width Availability: Property/method value type: JavaScript syntax: N Number primitive The clip region is defined by an extent rectangle that surrounds the space occupied by the clip region. An extent rectangle is that smallest rectangle that completely encloses the item. This property specifies the width of that extent rectangle. #BREAK# JavaScript Programmer’s Reference Warnings: . No longer supported in Netscape 6.0. See also: Layer.clip.width, Rect.width clipboardData (Property) A global browser variable that refers to the clipboardData object for the window. Availability: JScript 5.0 Internet Explorer 5.0 Property/method value type: clipboardData object IE clipboardData JavaScript syntax: IE myWindow.clipboardData See also: clipboardData object, Window.clipboardData clipboardData object (Object/JScript) An object that can be used with editing operations to provide script-driven access to the clipboard contents. Availability: JScript 5.0 Internet Explorer 5.0 IE myClipboardData = clipboardData JavaScript syntax: IE myClipboardData = myWindow.clipboardData Object methods: clearData(), getData(), setData() If you want to move data in and out of the clipboard on a Windows platform from within the MSIE browser, this object encapsulates the clipboard contents. Refer to the dataTransfer object for a description of the clearData(), getData(), and setData() methods that may also be used with the clipboardData object. See also: dataTransfer.clearData(), dataTransfer.getData(), Window.clipboardData Method JavaScript JScript N IE Opera Notes clearData() 5.0 + 5.0 + - etData() 5.0 + 5.0 + - setData() 5.0 + 5.0 + - #BREAK# C close() (Method) close() (Method) A function that closes the receiving window. Availability: JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Opera 3.0 Property/method value type: undefined -close() JavaScript syntax: -myWindow.close() See also: UniversalBrowserAccess, UniversalBrowserWrite, Window.close() closed (Property) A flag indicating the window disposition. Argument list: Property attributes: ReadOnly. Refer to: Window.closed Availability: JavaScript 1.1 JScript 3.0 Internet Explorer version 4.0 Netscape Navigator version 3.0 Opera browser 3.0 Property/method value type: Boolean primitive -closed JavaScript syntax: -myWindow.closed false The window is still open true The window has been closed #BREAK# JavaScript Programmer’s Reference Closure object (Object/internal) A special kind of function object that preserves prototype inheritance and scope. Availability: JavaScript 1.2 Netscape 4.0 JavaScript syntax: N myClosure = new Closure() Object properties: __parent__, __proto__ This is a special kind of object, which maintains some contextual state information when it is created. It can behave like a function, but is a kind of function wrapper that references a function and a scope. Since it inherits everything from the Functionobject, it can behave like a function and can be called as such. Because it also stores the scope chain at the time it is manufactured, it can restore that scope chain when it is executed. See also: Lexical scoping Property JavaScript JScript N IE Opera Notes __parent__ 1.2 + 4.0 + - __proto__ 1.2 + 4.0 + - Closure() (Object/Navigator) A Closure object constructor. Availability: JavaScript 1.2 Netscape 4.0 JavaScript syntax: N new Closure(aFunction, aTarget) aFunction The declaration of a function Argument list: aTarget An object to associate the function with This constructor is used internally to create a Closure object containing the function associated with a target object. The Closure() constructor is used in Netscape 4 to create an event-handler function that can be forced to run in a scope containing a target object. #BREAK# C Closure.__parent__ (Property) Example code: document.form1.myButton.onclick = new Closure( function() { document.validated = false; }, document.form1.myButton ); See also: Constructor function, constructor property, Global object, Object constant Closure.__parent__ (Property) A reference to a scope-chain object that is preserved with the function by the Closure object. JavaScript 1.2 ScopeChain object N myClosure.__parent__ Availability: Netscape 4.0 Property/method value type: JavaScript syntax: See also: __parent__, __proto__, Lexical scoping, Closure object Closure.__proto__ (Property) A reference to a function that is encapsulated by the Closure object. JavaScript 1.2 Function object myClosure.__proto__ N Availability: Netscape 4.0 Property/method value type: JavaScript syntax: See also: __parent__, __proto__, Lexical scoping, Closure object #BREAK# JavaScript Programmer’s Reference clsid: URL (Request method) Used by MSIE to locate ActiveX controls for the