Previous Page TOC Index Next Page Home


B

JavaScript Language Reference

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

The anchor Object

See the anchors property of the document object.

The button Object

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

Properties

Methods

Event Handlers

The checkbox Object

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

Properties

Methods

Event Handlers

The Date Object

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)

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

"month day, year hours:minutes:seconds"

year, month, day

year, month, day, hours, minutes, seconds

where the later two options represent integer values.

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

Methods

Day, DD Mon YYYY HH:MM:SS TZN

Mon DD, YYYY

Day, DD Mon YYYY HH:MM:SS GMT

The document Object

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

Properties

Methods

The form Object

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

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)

The hidden Object

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

Properties

The history Object

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 is not reflected into JavaScript.

Properties

Methods

The link object

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

Properties

Event Handlers

The location Object

The location object reflects information about the current URL.

Properties

The Math Object

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

Properties

Methods

The navigator object

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

Properties

The password Object

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

Properties

Methods

The radio Object

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], etc.

Properties

Methods

Event Handlers

The reset Object

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

Properties

Methods

Event Handlers

The select Object

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 (i.e. reflects 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.

options

A string value containing the full HTML code for 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 (i.e. reflects the VALUE attribute).

Event Handlers

The string Object

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

Properties

Methods

The submit Object

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

Properties

Methods

Event Handlers

The text Object

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

Properties

Methods

Event Handlers

The textarea Object

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

Properties

Methods

Event Handlers

The window Object

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

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

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

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 integer 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 leftmost bit are shifted in from the left

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.

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

comma (,)

assignment operators (= += -= *= /= %=)

conditional (? :)

logical or (||)

logical and (&&)

bitwise or (|)

bitwise xor (^)

bitwise and (&)

equality (== !=)

relational (< <= > >=)

shift (<< >> >>>)

addition/subtraction (+ -)

multiply/divide/modulus (* / %)

negation/increment (! - ++ --)

call, member (() [])

Previous Page TOC Index Next Page Home