Previous Page TOC Next Page See Page



- C -
JavaScript Language Reference


The first part of this reference is organized by object, with properties and methods listed by the object to which they apply. The second part covers independent functions in JavaScript not connected with a particular object, as well as operators in JavaScript.



Note:

In this section the following codes are used to indicate which platforms support any given command, object, property, method, function, event handler, or statement: C-Client JavaScript, S-Server JavaScript, 2-Navigator 2, 3-Navigator 3, I-Internet Explorer 3.



The anchor Object [C|2|3|I]


The anchor object reflects an HTML anchor.

Properties



The applet Object [C|3]


The applet object reflects a Java applet included in a Web page with the APPLET tag.

Properties



The area Object [C|3]


The area object reflects a clickable area defined in an imagemap. area objects appear as entries in the links array of the document object.

Properties



Event Handlers



The Array Object [C|3|I]


Provides a mechanism for creating arrays and working with them. New arrays are created with arrayName = new Array() or arrayName = new Array(arrayLength).

Properties



Methods



The button Object [C|2|3|I]


The button object reflects a push button from an HTML form in JavaScript.

Properties



Methods



Event Handlers



The checkbox Object [c|2|3|I]


The checkbox object makes a checkbox from an HTML form available in JavaScript.

Properties



Methods



Event Handlers



The client Object [S]


The client object provides information about the current client accessing the server.

Methods



The combo Object [C|I]


The combo object reflects a combo field into JavaScript.

Properties



Methods



Event Handlers



The cursor Object [S]


The cursor object reflects the answer returned by an SQL statement from a database.

Properties


blob(FileName) Assigns BLOb data from FileName to the column.
blobImage(format,altText,align,width,height,border,ismap) Displays BLOb data from the column as a data where format is a string indicating the image format, altText is displayed if the browser doesn't support images, align is a string specifying the images alignment, width, height, and border are integer values in pixels, and ismap is a Boolean value indicating if the image is an imagemap.
BlobLink(mimeType, text) Returns a hyperlink to a binary file containing the BLOb data. MimeType indicates the type of the file and text is text that should be displayed for the link.

Methods



The database Object [S]


The database object provides methods for connecting to a database server.

Methods



The Date Object [C|S|2|3|I]


The Date object provides mechanisms for working with dates and times in JavaScript. Instances of the object can be created with the syntax

newObjectName = new Date(dateInfo)

dateInfo is an optional specification of a particular date and can be one of the following:

year, month, day, hours, minutes, seconds

The latter two options represent integer values.

If no dateInfo is specified, the new object represents the current date and time.

Properties



Methods


Mon DD, YYYY

Day, DD Mon YYYY HH:MM:SS GMT


The document Object [C|2|3|I]


The document object reflects attributes of an HTML document in JavaScript.

Properties



Methods



The File Object [S]


The File object provides mechanisms for a server application to work with files on the server. A file object can be created with the syntax filePointer = new File(filename).

Methods



The FileUpload Object [C|3]


The FileUpload object reflects a file upload element in an HTML form.

Properties



The form Object [C|2|3|I]


The form object reflects an HTML form in JavaScript. Each HTML form in a document is reflected by a distinct instance of the form object.

Properties



Methods



Event Handlers



The frame Object [C|2|3|I]


The frame object reflects a frame window in JavaScript.

Properties



Methods


toolbar=[yes,no,1,0] Indicates if the window should have a toolbar
location=[yes,no,1,0] Indicates if the window should have a location field
directories=[yes,no,1,0] Indicates is the window should have directory buttons
status=[yes,no,1,0] Indicates if the window should have a status bar
menubar=[yes,no,1,0] Indicates if the window should have menus
scrollbars=[yes,no,1,0] Indicates if the window should have scroll bars
resizable=[yes,no,1,0] Indicates if the window should be resizable
width=pixels Indicates the width of the window in pixels
height=pixels Indicates the height of the window in pixels

name = setTimeOut(expression,time)


Event Handlers



The Function Object [C|3]


The Function object provides a mechanism for indicating JavaScript code to compile as a function. The syntax to use the Function object is: functionName = new Function(arg1, arg2, arg3, ..., functionCode). This is similar to

function functionName(arg1, arg2, arg3, ...) {
   functionCode
}

except that in the former functionName is a variable with a reference to the function and the function is evaluated each time it is used rather than being compiled once.

Properties



The hidden Object [C|2|3|I]


The hidden object reflects a hidden field from an HTML form in JavaScript.

Properties



The history Object [C|2|3|I]


The history object allows a script to work with the Navigator browser's history list in JavaScript. For security and privacy reasons, the actual content of the list isn't reflected into JavaScript.

Properties



Methods



The Image Object [C|3]


The Image object reflects an image included in an HTML document.

Properties



Event Handlers



The link object [C|2|3|I]


The link object reflects a hypertext link in the body of a document.

Properties



Event Handlers



The location Object [C|2|3|I]


The location object reflects information about the current URL.

Properties



Methods



The Math Object [C|S|2|3|I]


The Math object provides properties and methods for advanced mathematical calculations.

Properties



Methods



The mimeType Object [C|3]


The mimeType object reflects a Mime type supported by the client browser.

Properties



The navigator object [C|2|3|I]


The navigator object reflects information about the version of Navigator being used.

Properties


Mozilla/2.0b6 (Win32; I)


Methods



The Option object [C|3]


The Option object is used to create entries in a select list using the syntax optionName = new Option(optionText, optionValue, defaultSelected, selected) and then selectName.options[index] = optionName.

Properties



The password Object [C|2|3|I]


The password object reflects a password text field from an HTML form in JavaScript.

Properties



Methods



Event Handlers



The plugin Object


The plugin object reflects a plug-in supported by the browser.

Properties



The project Object [S]


The project object provides a means to track global information for a server-based application.

Methods



The radio Object [C|2|3|I]


The radio object reflects a set of radio buttons from an HTML form in JavaScript. To access individual radio buttons, use numeric indexes starting at zero. For instance, individual buttons in a set of radio buttons named testRadio could be referenced by testRadio[0], testRadio[1], and so on

Properties



Methods



Event Handlers



The request Object [S]


The request object provides data about the current request from the client.

Properties



The reset Object [C|2|3|I]


The reset object reflects a reset button from an HTML form in JavaScript.

Properties



Methods



Event Handlers



The select Object [C|2|3]


The select object reflects a selection list from an HTML form in JavaScript.

Properties


defaultSelected A Boolean value indicating if an option was selected by default (reflecting the SELECTED attribute).
index An integer value reflecting the index of an option.
length An integer value reflecting the number of options in the selection list.
name A string value containing the name of the selection list.
selected A Boolean value indicating if the option is selected. Can be used to select or deselect an option.
selectedIndex An integer value containing the index of the currently selected option.
text A string value containing the text displayed in the selection list for a particular option.
value A string value indicating the value for the specified option (reflecting the VALUE attribute).

Methods



Event Handlers



The server Object [S]


The server object provides global information about the server.

Properties



Methods



The String Object [C|S|2|3|I]


The String object provides properties and methods for working with string literals and variables.

Properties



Methods



The submit Object [C|2|3|I]


The submit object reflects a submit button from an HTML form in JavaScript.

Properties



Methods



Event Handlers



The text Object [C|2|3|I]


The text object reflects a text field from an HTML form in JavaScript.

Properties



Methods



Event Handlers



The textarea Object [C|2|3|I]


The textarea object reflects a multi-line text field from an HTML form in JavaScript.

Properties



Methods



Event Handlers



The window Object [C|2|3|I]


The window object is the top-level object for each window or frame and is the parent object for the document, location, and history objects.

Properties



Methods


toolbar=[yes,no,1,0] Indicates if the window should have a toolbar
location=[yes,no,1,0] Indicates if the window should have a location field
directories=[yes,no,1,0] Indicates if the window should have directory buttons
status=[yes,no,1,0] Indicates if the window should have a status bar
menubar=[yes,no,1,0] Indicates if the window should have menus
scrollbars=[yes,no,1,0] Indicates if the window should have scroll bars
resizable=[yes,no,1,0] Indicates if the window should be resizable
width=pixels Indicates the width of the window in pixels
height=pixels Indicates the height of the window in pixels

name = setTimeOut(expression,time)


Event Handlers



Independent Functions, Operators, Variables, and Literals



Independent Functions



Operators



Table C.1. Assignment operators.

Operator Description
= Assigns value of right operand to the left operand
+= Adds the left and right operands and assigns the result to the left operand
-= Subtracts the right operand from the left operand and assigns the result to the left operand
*= Multiplies the two operands and assigns the result to the left operand
/= Divides the left operand by the right operand and assigns the value to the left operand
%= Divides the left operand by the right operand and assigns the remainder to the left operand

Table C.2. Arithmetic operators.

Operator Description
+ Adds the left and right operands.
- Subtracts the right operand from the left operand.
* Multiplies the two operands.
/ Divides the left operand by the right operand.
% Divides the left operand by the right operand and evaluates to the remainder.
++ Increments the operand by one (can be used before or after the operand).
-- Decreases the operand by one (can be used before or after the operand).
- Changes the sign of the operand.

Table C.3. Bitwise Operators in JavaScript.

Operator Description
AND (or &) Converts operands to integers with 32 bits, pairs the corresponding bits, and returns one for each pair of ones. Returns zero for any other combination.
OR (or |) Converts operands to integers with 32 bits, pairs the corresponding bits and returns one for each pair where one of the two bits is one. Returns zero if both bits are zero.
XOR (or ^) Converts operands to integers with 32 bits, pairs the corresponding bits, and returns one for each pair where only one bit is one. Returns zero for any other combination.
<< Converts the left operand to an integer with 32 bits and shifts bits to the left the number of bits indicated by the right operand—bits shifted off to the left are discarded and zeros are shifted in from the right.
>>> Converts the left operand to an integer with 32 bits and shifts bits to the right the number of bits indicated by the right operand—bits shifted off to the right are discarded and zeros are shifted in from the left.
>> Converts the left operand to an integer with 32 bits and shifts bits to the right the number of bits indicated by the right operand—bits shifted off to the right are discarded and copies of the left-most bit are shifted in from the left.

Table C.4. Logical operators.

Operator Description
&& Logical "and"—returns true when both operands are true, otherwise it returns false.
|| Logical "or"—returns true if either operand is true. It only returns false when both operands are false.
! Logical "not"—returns true if the operand is false and false if the operand is true. This is a unary operator and precedes the operand.

Table C.5. Logical (comparison) operators.

Operator Description
== Returns true if the operands are equal.
!= Returns true if the operands are not equal.
> Returns true if the left operand is greater than the right operand.
< Returns true if the left operand is less than the right operand.
>= Returns true if the left operand is greater than or equal to the right operand.
<= Returns true if the left operand is less than or equal to the right operand.

call, member (() [])


JavaScript Statement


Previous Page Page Top TOC Next Page See Page