Note:
In this section the following codes are used to indicate
which platform. 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
- name - A string value indicating the name
of the anchor. [Not 2|3]
The applet Object [C|3]
The applet object reflects a Java applet included in a
Web page with the APPLET tag.
Properties
- name - A string reflecting the NAME
attribute of the APPLET tag.
The area Object [C|3]
The area object reflects a clickable area defined in
an image map. area objects appear as entries in the links
array of the document object.
Properties
- hash - A string value indicating an anchor
name from the URL.
- host - A string value reflectin the host
and domain name portion of the URL.
- hostname - A string value indicating the
host, domain name, and port number from the URL.
- href - A string value reflecting the
entire URL.
- pathname - A string value reflecting the
path portion of the URL (excluding the host,
domain name, port number, and protocol).
- port - A string value indicating the port
number from the URL.
- protocol - A string value indicating the
Protocol portion of the URL, including the
trailing colon.
- search - A string value specifying the
query Portion of the URL (after the question
mark).
- target - A string value reflecting the
TARGET attribute of the AREA tag.
Event Handlers
- onMouseOut - Specifies JavaScript code to
execute when the mouse moves outside the area
specified in the AREA tag.
- onMouseOver - Specifies JavaScript code to
execute when the mouse enters the area specified
in the AREA tag.
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
- length - An integer value reflecting the
number of elements in an array.
- Prototype - Provides a mechanism to add
properties to an Array object.
Methods
- join(string) - Returns a string containing
each element of the array separated by string.
[Not 1]
- reverse() - Reverses the order of an
array. [Not 1]
- sort(function) - Sorts an
array based on function that indicates a function
defining the sort order. function can
be omitted, in which case the sort defaults to
dictionary order. [Not I]
The button Object [C|2|3|I]
The button object reflects a Push button from an HTML
form in JavaScript.
Properties
- enabled - A boolean value indicating
whether the button is enabled. [Not 2|3]
- form - A reference to the form object
containing the butt on. [Not 2|3]
- name - A string value containing the name
of the button element.
- type - A string value reflecting the TYPE
attribute of the INPUT tag. [Not 2 1 I]
- value - A string value containing the
value of the button element.
Methods
- click() - Emulates the action of clicking
the button.
- focus() - Gives focus to the button. [Not
2|3]
Event Handlers
- onclick - Specifies JavaScript code to
execute when the button is clicked.
- onFocus - Specifies JavaScript code to
execute when the button receives focus. [Not 2|3]
The checkbox Object [C|2|3|I]
The cheekbox object makes a cheekbox from an HTML form
available in JavaScript.
Properties
- checked - A boolean value indicating
whether the cheekbox element is checked.
- defaultChecked - A boolean value
indicating whether the cheekbox element was
checked by default (reflects the CHECKED
attribute).
- enabled - A boolean value indicating
whether the checkbox is enabled. [Not 2|3]
- form - A reference to the form object
containing the cheekbox. [Not 2|3]
- name - A string value containing the name
of the cheekbox element.
- type - A string value reflecting the TYPE
attribute of the INPUT tag. [Not 2|I]
- value - A string value containing the
value of the cheekbox element.
Methods
- click() - Emulates the action of clicking
the checkbox.
- focus() - Gives focus to the cheekbox.[Not
2|3]
Event Handlers
- onClick - Specifies JavaScript code to
execute when the cheekbox is clicked.
- onFocus - Specifies JavaScript code to
execute when the cheekbox recei,7e-focus. [Not
2|3]
The client Object [S]
The client object provides information about the
current client accessing the server.
Methods
- destroy()-Removes all properties from the
client object and destroys the client.
- expiration(seconds)-Sets the client
objeet's expiration to seconds seconds
from the current time.
The combo Object [C|l]
The combo object reflects a combo field in JavaScript.
Properties
- enabled-A boolean value indicating whether
the cheekbox is enabled. [Not 2|3]
- form - A reference to the form object
containing the checkbox. [Not 2|3]
- listCount - An integer reflecting the
number of elements in the list.
- listIndex - An integer reflecting the index
of the selected element in the list.
- multiselect - A boolean value indicating
whether the combo field is in multiselect mode.
- name - A string value reflecting the name of
the combo field.
- value - A string containing the value of the
combo field.
Methods
- addItem(index)-Adds an item to the combo
field before the item at index. 4
clicko-Simulates a click on the combo field.
- Clear() - Clears the contents of the combo
field.
- focus() - Gives focus to the
combo field.
- removeItem(index) - Removes the item
atindex from the combo field.
Event Handlers
- onClick - Specifies JavaScript code to
execute when the mouse clicks the combo field.
- onFoCus - Specifies JavaScript code to
execute when the combo field receives focus.
The cursor Object [S]
The cursor object reflects the answer returned by an
SQL statement from a database.
Properties
- cursortColumn - An array reflecting the
columns in the data returned from the server.
Each array entry is an object with the following
methods:
blob(FileName) |
Assigns BLOB data
from FileName to the column. |
blobImage(format,altText,
align,width,height,border, .ismap) |
Displays BLOB data
from the column where format is a string
indicating the image format, aittext is displayed
if the browser doesn't support images, align is
a string specifying the image alignment, width,
height, and border are integer values in
pixels, and ismap is a boolean value
indicating whether the image is an image map. |
BlobLink(mimeType,
text) |
Returns a hyperlink
to a binary file containing the BLOB data. mime
Type indicates the type of the file, and text
is text that should be displayed for the link. |
Methods
- close() - Closes a cursor.
- columnName(index) - Returns the name of
the column specified by index.
- columns() - Returns the number
of columns in a cursor.
- deleteRow(table) - Deletes a row from
table.
- insertRow(table) - Inserts a row into
table.
- next() - Navigates to the next row in a
cursor.
- updateRow(table) - Updates the current row
in tabze with the current row from the cursor.
The database Object [S]
The database object Provides methods for connecting to
a database server.
Methods
- begintransaction()-Starts a transaction
with the SQL Server.
- commitTransactiono-Commits the transaction
to the server.
- connect (type, name, user, password, database) -
Connects
to database on a server of type type named
name using the username user and
providing password for access.
- connected() - Returns a boolean value
indicating whether the application is connected
to a database.
- cursor(statement, update) - Creates
a cursor for the specified statement and
uses the boolean value update to indicate
whether the cursor is updateable.
- disconnect() - Disconnects from the
database.
- execute(statement) - Executes statement.
- rollbackTransaction() - Rolls back the
transaction.
- SQLTable(statement) - Display query
results for statement.
- majorErrorCode() - Returns the major error
code from the database server.
- minorErrorCode() - Returns the minor error
code from the database server.
- majorErrorMessage() - Returns the major
error message from the database server.
- minorErrorMessage() - Returns the minor
error message from the database server.
The Date Object [C|S|2|3|I]
The Date object provides mechanisms for forking 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:
- month, day, year, hours:minutes:seconds year,
month, day
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
- prototype - Provides a mechanism for
adding properties to a Date object. [Not 2]
Methods
- getDate() - Returns the day of the month
for the current Date object as an integer from 1
to 31.
- getDay() - Returns the day of the week for
the current Date object as an integer from 0 to 6
(where 0 is Sunday, 1 is Monday, and so on).
- getHours() - Returns the hour from the
time in the current Date object as an integer
from 0 to 23.
- getminutes() - Returns the minutes from
the time in the current Date object as an integer
from 0 to 59.
- getmonth() - Returns the month for the
current Date object as an integer from 0 to 11
(where 0 is January, 1 is February, and so on).
- getseconds() - Returns the seconds from
the time in the current Date object as an integer
from 0 to 59.
- getTime() - Returns the time of the
current Date object as an integer representing
the number of milliseconds since 1 January 1970
at 00:00:00.
- getTimezoneOff set() - Returns the
difference between the local time and GMT as an
integer representing the number of minutes.
- getYear() - Returns the year of the week
for the current Date object as a two-digit
integer representing the year minus 1900.
- parse (dateString) - Returns the number of
milliseconds between January 1, 1970 at 00:00:00
and the date specified in datestring.
datestring should take the format:
Day, DD Mon YYYY HH:MM:SS TZN
Mon DD, YYYY [Not I]
- setDate(datevalue) - Sets the day of the
month for the current Date object. datevalue is
an integer from 1 to 31.
- sethours (hours Value) - Sets the
hours for the time for the current Date object.
hoursvalue is an integer from o to 23.
- setMinutes(ininutesValue) - Sets the
minutes for the time for the current Date Object.
minutesvalue is an integer from o to 59.
- setMonth(monthvaiue) - Sets the month for
the current Date object. monthValue is an
integer from o to 1 1 (where 0 is January, 1 is
February, and so on).
- setseconds (secOndsvalue) -
Sets the seconds for the tirne for the current
Date object. seCondsValle is an integer
from 0 to 59.
- setTime(timev8lue)-Sets the value
for the current Date object. tifoevalue is
1970 at 00:00:00. an integer representing the
number Of milliseconds since January 1,
- sotyoar(yearvalue)-Sets the year
for the current Date object. Yearvalue is an
integer greater than 1 900.
- toGMT5tring ()-Returns the value of the
current Date object in GMT as a string using
Internet conventions in the form
Day, DD Mon Yyyy HH:MM:SS GMT
- toLocalestring()-Returns the value of the
current Date object in the local tine using local
conventions.
- UTC(Yearvalue, wonthvalue, datevalue,
hoursvaiue, minutesvalue, secondsvalue) -
Returns the number of milliseconds since Jan'uary
1, 1970 at 00:00:oo GMT. Y,arvalue is an
integer greater than 1900. monthvalue
is an integer from o to 1 1. da te Val ue
is an integer from 1 to 3 1. hours
val ue is an integer froril 0 to 23. oinutesvalue
and secondsvalue are integers fron, o to 59.
hoursvalue, fn-inutesvalue, and
secondsvalue are optional. [Not l]
The document Object [C|2|3|I]
The document object reflects attributes of ai HTML
document in JavaScript.
Properties
- alinkColor - The color of active links as a
string or a hexadecimal triplet.
- anchors
- Array of anchor objects in the order they appear in
the HTML document. Use anchors. length to get
the number of anchors in a document.
- applets - Array of applet objects in the
order they appear in the HTML document. Use
applets. length to get the number of applets in a
document. [Not 2]
- bgcolor - The color of the document's
background.
- cookie - A string Value containing cookie
values for the current document.
- einbeds - Array of Pi,gin objects in the
order they appear in the HTML document. Use
embeds. length to get the number of Plug-ins in a
document. [Not 2|I]
- fgcolor - The color of the document's
foreground.
- forms - Array of form objects in the order the
forms appear in the HTML file. Use forms. length
to get the number of forms in a document.
- :Lm&ges-Array of image objects in the order
they appear in the HTML document. Use images.
length to get the number of images in a document.
[Not 2 1 I]
- lastModified - String value containing the last
date of modification of the document.
- linkColor - The color of links as a string or a
hexadecimal triplet. links-Array of link objects
in the order the hypertext links appear in the
HTML document. Use links. length to get the
number of links in a document.
- location - A string containing the URL of the
current document. Use document. URL instead of
document. location. This property is expected to
disappear in a future release.
- referrer - A string value containing the URL of
the calling document when the user follows a
link.
- title - A string containing the title of the
current document.
- URL - A string reflecting the URL of the
current document. Use instead of document.
location. [Not 1]
- vlinkColor - The color of followed links as a
string or a hexadecimal triplet.
Methods
- clear() - Clears the document
window. [Not I]
- close() - Closes the current
output stream.
- open(,wimeType) - Opens a
stream that allows write() and writeln() methods
to write to the document window. mime Type is
an optional string that specifies a document type
supported by Navigator or a plug-in (text/html,
image/gif, and so on).
- Write() - Writes text and HTML
to the specified document.
- Writeln() - Writes text and HTML
to the specified document, followed by a newline
character.
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(f.ilename).
Methods
- byteToString(number) - Returns number
as a string. number should be a single
byte.
- clearError() - Clears the error
status for the object.
- close() - Closes the file.
- eof() - Returns a boolean value
indicating whether the current file pointer
is positioned past the end of the file.
- error() - Returns the current error status
for the object.
- exists() - Returns a boolean value
indicating whether or not the file exists.
- flush() - Writes the content of
the buffer to the file.
- getLength() - Returns the length
of the file in bytes.
- getposition() - Returns the current
position of the pointer in the file.
- open(mode) - Opens the file with
the specified mode.
- read(number) - Reads number
characters from the file.
- readByte() - Reads one byte from the file.
- readln() - Reads the current line from the
file.
- setposition(position, reference) -
Positions the pointer at position relative
to reference. Possible references are o
(beginning of file), 1 (current position), 2 (end
of file), and unspecified (beginning of file).
- stringToByte(string) - Converts the first
character of string to a byte.
- write(string) - Writes string to
the file.
- writeByte(nusiber) - Writes the byte number
to the file.
- writeln(string) - Writes string to
the file followed by a new line character.
The FileUpload Object [C13]
The FileUpload object reflects a file upload element
in an HTML form.
Properties
- name - A string value reflecting the name
of the file upload element.
- value - A string value reflecting the file
upload element's field.
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
- action - A string value specifying the URL
to which the form data is submitted.
- elements - Array of objects for each form
element in the order in which they appear in the
form.
- encoding - String containing the MIME
encoding of the form as specified in the ENCTYPE
attribute.
- method - A string value containing the
method of submission of form data to the server.
- target - A string value containing the
name of the window to which responses to form
submissions are directed.
Methods
- reset() - Resets the form. [Not
2|I] submito-Submitstheform.
Event Handlers
- onReset - Specifies JavaScript code to
execute when the form is reset. [Not 2|I]
- onSubmit - Specifies JavaScript code to
execute when the form is submitted. The code
should return a true value to allow the form to
be submitted. A false value prevents the form
from being submitted.
The frame Object [C|2|3|I]
The frame object reflects a frame window in
JavaScript.
Properties
- frames - An array of objects for each
frame in a window. Frames appear in the array in
the order in which they appear in the HTML source
code.
- onblur - A string reflecting the onblur
event handler for the frame. New values can be
assigned to this property to change the event
handler. [Not 21
- onfocus - A string reflecting the onFocus event handler
for the frame. New
values can be assigned to this property to change
the event handler. [Not 21
- Parent - A string indicating the name of
the window containing the frameset.
- self - An alternative for the
name of the current window. top-An alternative
for the name of the top-most window.
- window - An alternative for the name of
the current window.
Methods
- alert(message) - Displays message in
a dialog box.
- blur() - Removes focus from the
frame. [Not 2]
- close() - Closes the window.
- confirm(message) - Displays
message in a dialog box with OK and CANCEL
buttons. Returns true or false based on the
button clicked by the user.
- focus() - Gives focus to the
frame. [Not 2]
- open(url, name, features) - Opens
uri in a window named name. If name doesn't
exist, a new window is created with that name. features
is an optional string argument containing a
list of features for the new window. The feature
list contains any of the following name-value
pairs separated by commas and without additional
spaces:
toolbar=[yes,no,1,0] Indicates whether the window
should have a toolbar
location=[yes,no,1,0] Indicates whether the window
should have a location field
directories=[yes,no,1,0] Indicates whether the window
should have directory buttons
status=[yes,no,1,01 Indicates whether the window
should have a status bar
menubar=[yes,no,1,01 Indicates whether the window
should have menus
scrollbars=[yes,no,1,0] Indicates whether the window
should have scrollbars
resizable=[yes,no,1,0] Indicates whether 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
- prompt (message, response)-Displays message
in a dialog box with a text entry field with the
default value of response. The user's
response in the text entry field is returned as a
string.
- setTimeout(expression,time)-Evaluates expression
after time, where time is a value in
milliseconds. The time-out can be named with the
following structure:
name = setTimeOut(expression,tifne)
- clearTimeout(nan7e)-Cancels the time-out
with the name name.
Event Handlers
- onBlur - Specifies JavaScript
code to execute when focus is removed from a
frame. [Not 2]
- onFocus - Specifies JavaScript code to
execute when focus is applied from a frame. [Not
2]
The Function Object [C13]
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 (argl, arg2, arg3, functioncode). This
is similar to
Properties
- arguments-An integer reflecting the number
of arguments in a function.
- prototype-Provides a mechanism for adding
properties to a Function object.
The hidden Object [C|2|3|I]
The hidden object reflects a hidden field from an HTML
form in JavaScript.
Properties
- name - A string value containing the name
of the hidden element.
- type - A string value reflecting the TYPE
Property of the INPUT tag. [Not 2|I]
- value - A string value containing the
value of the hidden text element.
The history Object [C|2|3|I]
The history obect 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 r eflected in JavaScript.
Properties
- lengtil - An integer representing the
number of items in the history list. [Not 1]
Methods
- back() - Goes back to the previous
document in the history list. [Not I]
- forward() - Goes forward to the next
document in the history list. [Not 1]
- go(location) - Goes to the document in the
history list specified by
- location. location can be a string or
integer value. If it's a string, it represents
all or part of a URL in the history list. If it's
an integer, location represents the
relative position of the document in the history
list. As an integer, location can be
positive or negative. [Not 1]
The Image Object [C|3]
The image object reflects an image included in an HTML
document.
Properties
- border - An integer value reflecting the
width of the image's border in pixels.
- complete - A boolean value indicating
whether the image has finished loading.
- height - An integer value reflecting the
height of an image in pixels. hsPace-An integer
value reflecting the HSPACE attribute of
the IMG tag.
- lowsrc - A string value containing the URL
of the low-resolution version of the image to
load.
- name - A string value indicating the name
of the Image object.
- Prototype - Provides a mechanism for
adding properties to an Image object.
- src - A string value indicating the URL of
the image.
- vspace - An integer value reflecting the VSPACE
attribute of the imG tag.
- width - An integer value indicating the
width of an image in pixels.
Event Handlers
- onAbort - Specifies JavaScript code to
execute if the attempt to load the image is
aborted. [Not 2]
- onError - Specifies JavaScript code to
execute if there is an error while loading the
image. Setting this event handler to null
suppresses error messages if an error does occur
while loading. [Not 2]
- onLoad - Specifies JavaScript code to
execute when the image is finished loading. [Not
21
The link Object [C|2|3|I]
The link object reflects a hypertext link L the
body of a document.
Properties
- hash - A string value containing the
anchor name in the URL.
- host - A string value containing the
hostname and port number from the URL.
- hostname - A string value containing the
domain name (or numerical IP address) from the
URL.
- href - A string value containing the
entire URL.
- pathname - A string value specifying the
path portion of the URL.
- port - A string value containing the port
number from the URL.
- protocol - A string value containing the
protocol from the URL (including the colon, but
not the slashes).
- search - A string value containing any
information passed to a GET CGI -BIN call (any
information after the question mark).
- target - A string value containing the
name of the window or frame specified in the TARGET
attribute.
Event Handlers
- moveMouse - Specifies JavaScript code to
execute when the mouse pointer moves over the
link. [Not 2|3]
- onClick - Specifies JavaScript code to
execute when the link is clicked.
- onmouseover - Specifies JavaScript code to
execute when the mouse pointer moves over the
hypertext link.
The location Object [C|2|3|I]
The location object reflects information about the
current URL.
Properties
- hash - A string value containing the
anchor name in the URL.
- host - A string value containing the
hostname and port number from the URL.
- hostname - A string value containing the
domain name (or numerical IP address) from the
URL.
- href - A string value containing the
entire URL.
- pathname - A string value specifying the
path portion of the URL.
- port - A string value containing the port
number from the URL.
- protocol - A string value containing the
protocol from the URL (including the colon, but
not the slashes).
- search - A string value containing any
information passed to a GET CGI -BIN call
(any information after the question mark).
Methods
- reload() - Reloads the current document.
[Not 2|I]
- replace(url) - Loads url over the
current entry in the history list, making it
impossible to navigate back to the previous URL
with the back button. [Not 2|I]
The Math Object [C|S|2|3|I]
The math object provides properties and methods for
advanced mathematical calculations.
Properties
- E-The value of Euler's constant (roughly
2.718) used as the base for natural logarithms.
- LN1@The value of the natural logarithm of
10 (roughly 2.302). LN2-The value of the
natural logarithm of 2 (roughly 0.693). LOG1OE-The
value of the base 10 logarithm of E (roughly
0.434). [Not 2|3|I]
- LOG2E-The value of the base 2 logarithm of E
(roughly 1.442). [Not 2|3|I]
- Pi-The value of pi, used in calculating
the circumference and area of circles (roughly
3.1415).
- SORT1_2-The value of the square root of one-half
(roughly 0.707). SORT2-The value of the square
root of two (roughly 1.414).
Methods
- abs (number) -Returns the absolute
value of number. The absolute value is the
value of a number with its sign ignored, so
abs(4) and abs(-4) both return 4.
- acos(number) - Returns the are cosine of number
in radians.
- asin(number) - Returns the are sine
of number in radians.
- atan(nuinber) - Returns the arc tangent of
number in radians.
- atan2 (number 1, number2) -Returns
the angle of the polar coordinate corresponding
to the cartesian coordinate (numberi,number2).
[Not I]
- ceil (number) -Returns the next
integer greater than number-in other words,
rounds up to the next integer.
- cos (number) - Returns the cosine of
number where number represents an angle in
radians.
- exp(number) - Returns the value of E to
the power of number.
- floor (number) -Returns the next
integer less than number-in other words,
rounds down to the nearest integer.
- log (number) - Returns the natural
logarithm of number.
- max (nuniber 1, number2) - Returns
the greater of number 1 and number2.
- min(numberl,number2) - Returns the
smaller of numbers and number2.
- pow(nuoiberl,nun;ber2) - Returns
the value of numbers to the power of nuinber2.
- random() - Returns a random number between zero and
one (at press time, this method was only
available on UNIX versions of Navigator 2.0).
- round(number) - Returns the closest integer to
number, in other words, rounds to the closest
integer.
- sin (number) - Returns the sine of number
where number represents an angle in radians.
- sqrt(number) - Returns the square root of
number.
- tan(number) - Returns the tangent of number
where number represents an angle in radians.
The mimetype Object [C|3]
The mimetype object reflects a Mime type supported by
the client browser.
Properties
- type - A string value reflecting the Mime
type.
- description - A string containing a
description of the Mime type.
- enabledPlugin - A reference to the plugin
object for the plug-in supporting the Mime type.
- suffixes - A string containing a
comma-separated list of file suffixes for the
Mime type.
The navigator Object [C|2|3|I]
The navigator object reflects information about the
version of Navigator being used.
Properties
- appcodeName - A string value containing
the code name of the client (in other words,
"Mozilia " for Netscape Navigator).
- appName - A string value containing the
name of the client (in other words,
"Netscape " for Netscape Navigator).
- appversion - A string value containing the
version information for the client in the form
versionnumber (platforfn; country)
For instance, Navigator 2.0, beta 6 for Windows
95 (international version) would have an appve rsion
property with the value " 2. 0b6 (Win32; I)
".
- mimeTypes - An array of mimetype objects
reflecting the Mime types supported by the client
browser. [Not 2|I]
- plugins - An array Of plugin objects reflecting the
plug-ins in a document in the order of their
appearance in the HTML document. [Not 2|I]
- userAgent - A string containing the
complete value of the user-agent header sent in
the HTTP request. This contains all the
information in appCodeName and appversion:
Mozilla/2.0b6 (Win32; I)
Methods
- javaEnabledo-ReturnsabooleanvalueindicatingwhetherJavais
enabled in the browser. [Not 2|I]
The Option Object [C13]
The option object is used to create entrie in a select
list using this syntax:
optionname = new Option(optionText, optionvalue,
detaultselected, selected) and then selectname.options[indexl
= optionnaine
Properties
- def aultSelected - A boolean value
specifying whether the option is selected by
default.
- index - An integer value specifying the
option's index in the select list.
- prototype
- Provides a mechanism to add properties to an option
object.
- selected - A boolean value indicating
whether the option is currently selected.
- text - A string value reflecting the text
displayed for the option.
- value - A string value indicating the
value submitted to the server when the form is
submitted.
The password Object [C|2|3|I]
The password object reflects a password text fie' 1
from an HTML form in JavaScript.
Properties
- defaultValue-Astringvaluecontainingthedefaultvalueofthepassword
element (the value of the VALUE attribute).
- enabled - A boolean value indicating
whether the password field is enabled. [Not 2 i
31
- form - A reference to the form Object
containing the password field. [Not 2|3]
- name - A string value containing the name
of the password element.
- value - A string value containing the
value of the password element.
Methods
- focus()-Emulatestheactionoffocusinginthepasswordfield.
- bluro-Emulatestheactionofremovingfocusfromthepasswordfield.
- selecto-Emulatestheactionofselectingthetextinthepasswordfield.
Event Handlers
- onBlur - Specifies JavaScript code to
execute when the password field loses focus. [Not
2|3]
- onFocus - Specifies JavaScript code to
execute when the password field receives focus.
[Not 2|3]
The plugin Object
The plugin object reflects a plug-in supported by the
browser.
Properties
- name - A string value reflectin the name
of the plug-in.
- filename - A string value
reflecting the file name of the plug-in on the
system's disk.
- description - A string value containing
the description supplied by the plug-in.
The project Object [S]
The proi ect object provides a means to track global
information for a server-based application.
Methods
- lock() - Locks the project
object so that other clients can't modify its
properties.
- unlock() - Unlocks the object, enabling
other clients to make changes.
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 [ 01,
testradio 1 1 j, and so on.
Properties
- checked - A boolean value indicating
whether a specific button is checked. Can be used
to select or deselect a button.
- defaultChecked - A boolean value
indicating whether a specific button was checked
by default (reflects the CHECKED attribute).
[Not I]
- enabled - A boolean value indicating
whether the radio button is enabled. [Not 2131
- form - A reference to the f o rm object
containing the radio button. [Not 2131
- length-An integer value indicating the
number of radio buttons in the set. [Not I]
- name - A string value containing the name
of the set of radio buttons.
- value - A string value containing the
value of a specific radio button in a set
(reflecting the VALUE attribute).
Methods
- clicko-Emulates the action of clicking a
radio button.
- f ocus ()-Gives focus to the radio button.
[Not 2 131
Event Handlers
- onClick-Specifies JavaScript code to
execute when a radio button is clicked.
- onFocus-Specifies JavaScript code to
execute when a radio button receives focus. [Not
2131
The request Object [S]
The request object provides data about 1 te current
request from the client.
Properties
The reset Object [C|2|3|I]
The reset oh . ect reflects a reset button from an
HTML form in JavaScript.
Properties
- enabled - A boolean value indicating
whether the reset button is enabled. [Not 2 i 31
- form - A reference to the form object
containing the reset button. [Not 2 i 31 name-A
string value containing the name of the reset
element.
- value - A string value containin the value
of the reset element.
Methods
- click() - Emulates the action of
clicking on the reset button.
- focus() -
SpecifiesJavaScripteodetoexecutewhentheresetbutton
receives focus. [Not 2 131
Event Handlers
- onclick - Specifies JavaScript
code to execute when the reset button is clicked.
- onFocus - Specifies JavaScript
code to execute when the reset button receives
focus. [Not 2 1 31
The select Object [C1213]
The select object reflects a selection list fro: i an
HTML form in JavaScript.
Properties
· length-An integer value containing the number
of options in the selection list.
- name - A string value containing
the name of the selection list.
options-An array reflecting each of the options in
the selection list in the order they appear. The
options property has its own properties:
defaultselected A boolean value indicating whether 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 whether 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).
- selectedIndex - Reflects the index of the
currently selected option in the selection list.
Methods
- blur() - Removes focus from the
select list. [Not 2 131
- focus() -
Givesfocustotheselectlist.[Not2131
Event Handlers
- onBlur - Specifies JavaScript
code to execute when the selection list loses
focus.
- onFocus - Specifies JavaScript
code to execute when focus is given to the
selection list.
- onChange - Specifies JavaScript
code to execute when the selected option in the
list changes.
The server Object [S]
The server object provides global infe mation about
the server.
Properties
- hostname - A string value containing the
full host of the server, including port number.
- host - A string value reflecting the host
and domain name of the server without the port
number.
- protocol - A string value containing the
protocol being used, including the trailing
colon.
- port - A string value reflecting the port
number the server watches for incoming requests.
Methods
- lock() - Locks the server object so that
other clients can't modify its properties.
- unlock() -
Unlockstheobject,enablingotherelientstomakeehanges.
The String Object [C|S|2|3|I]
The string objeet provides properties and methods for
working with string literals and variables.
Properties
- length-An integer value containing the
length of the string expressed as the number of
characters in the string.
- prototype-Provides a mechanism for adding
properties to a String object. [Not 21
Methods
- anchor(name) - Returns a string containing
the value of the string object surrounded by an A
container tag with the NAME attribute
set to name.
- big() - Returns a string
containing the value of the string object
surrounded by a BIG container tag.
- blink() - Returns a string
containing the value of the string object
surrounded by a BLINK container tag.
- bold() - Returns a string
containing the value of the string object
surrounded by a i3 container tag.
- charat (Index) -Returns the character at
the location specified by index.
- fixed() - Returns a string
containing the value of the string object
surrounded by a FIXED container tag.
- fontColor(color)-Returns a string
containing the value of the string object
surrounded by a FONT container tag with the COLOR
attribute set to color where color is a color
name or an RGB triplet. [Not I]
- fontSize(size)-Returns a string containing
the value of theString object surrounded by a
FONTSIZE container tag with the size set to size.
[Not I]
- indexof (findString,startinglndex)-Returns
the index of the first occurrence of findstring,
starting the search at startingindex where
startingindex is optional. If it isn't
provided, the search starts at the start of the
string.
- italics() - Returns a string
containing the value of the string object
surrounded by an i container tag.
- lastIndexOf (findstring, startingrndex)
- Returns the index of the last occurrence of findstring.
This is done by searching backwards from startingindex.
startingindex is optional and is assumed to
be the last character in the string if no value
is provided.
- link (href ) -Returns a string
containing the value of the st ring object
surrounded by an A container tag with the
HREF attribute set to href.
- small() - Retums a string
containing the value of the string object
surrounded by a SMALL container tag.
- split(separator) - Retums an array of
strings created by splitting the string at every
occurrence of separator. [Not S|2|I]
- strike() - Returns a string containing the
value of the string object surrounded by a STR
I KE container tag.
- sub() - Returns a string
containing the value of the string object
surrounded by a suB container tag.
- substring (firstlndex, lastIndex)
- Returns a string equivalent to the substring starting
at firstindex and ending at the character
before lastindex. If firstindex is greater
than lastindex, the string starts at lastindex
and ends at the character before firstindex.
- sup() - Returns a string
containing the value of the string object
surrounded by a sup container tag.
- toLowerCase() - Returns a string
containing the value of the string object with
all characters converted to lowerease.
- touppercase() - Returns a string containing
the value of the string object with all
characters converted to uppercase.
The submit Object [C|2|3|I]
The submit object reflects a submit button from an
HTML form in JavaScript.
Properties
- enabled - A boolean value indicating
whether the submit button is enabled. [Not 2131
- form - A reference to the form
object containing the submit button.[Not 2 i 3]
- name - A string value containing the name
of the submit button element.
- type - A string value reflecting the TYPE
attribute of the INPUT tag. [Not 2 1 I]
- value - A string value containing the
value of the submit button element.
Methods
- click() - Emulates the action of clicking
on the submit button.
- focus() - Gives focus to the
submit button. [Not 2 131
Event Handlers
- onClick - Specifies JavaScript code to
execute when the submit button is clicked.
- onFocus - Specifies JavaScript code to
execute when the submit button receives focus.
[Not 2 1 31
The text Object [C|2|3|I]
The text object reflects a text field from an HTML
form in JavaScript.
Properties
- defaultValue - A string value containing
the default value of the text element (in other
words, the value of the VALUE attribute).
- enabled - A boolean value indicating
whether the text field is enabled. [Not 2131
- form - A reference to the form
object containing the text field. [Not 2 131
- name - A string value containing the name
of the text element.
- type - A string value reflecting the TYPE
attribute of the INPUT tag. [Not 2|I]
- value - A string value containing the
value of the text element.
Methods
- focus() - Emulates the action of focusing
in the text field.
- blur() - Emulates the action of
removing focus from the text field.
- select() - Emulates the action of
selecting the text in the text field.
Event Handlers
- onBlur - Specifies JavaScript code to
execute when focus is removed from the field.
- onChange - Specifies JavaScript
code to execute when the content of the field is
changed.
- onFocus - Specifies JavaScript
code to execute when focus is given to the field.
- onSelect-Specifies JavaScript code to
execute when the user selects some or all of the
text in the field.
The textarea Object [C|2|3|I]
The textarea object reflects a multiline text fie' .
from an HTML form in JavaScript.
Properties
- defaultValue - A string value containing
the default value of the textarea element (the
value of the VALUE attribute).
- enabled - A boolean value indicating
whether the textarea field is enabled. [Not 2131
- form - A reference to the form object
containing the textarea field. [Not 2131
- name - A string value containing the name
of the textarea element.
- type - A string value reflecting the type
of the textarea object. [Not 2|I]
- value - A string value containing the
value of the textarea element.
Methods
- focus() - Emulates the action of focusing in the
textarea field.
- blur() - Emulates the action of removing focus from
the textarea field.
- select() - Emulates the action of selecting the
text in the textarea field.
Event Handlers
- onBlur - Specifies JavaScript code to
execute when focus is removed from the field.
- onChange - Specifies JavaScript code to
execute when the content of the field is
changed.
- onFocus - Specifies JavaScript code to
execute when focus is given to the field.
- onSelect - Specifies JavaScript code to
execute when the user selects some or all of the
text in the field.
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
- defaultStatus - A string value containing
the default value displayed in the status bar.
- frames - An array of objects for each frame
in a window. Frames appear in the array in the
order in which they appear in the HTML source
code.
- length - An integer value indicating the
number of frames in a parent window. [Not I]
- name - A string value containing the name
of the window or frame.
- opener - A reference to the window object
containing the open () method used to open the
current window. [Not 2 1 I]
- parent - A string indicating the name of
the window containing the frameset.
- self - An alternative for the name of the
current window.
- status - Used to display a message in the
status bar. This is done by assigning values to
this property.
- top - An alternative for the name of the
top-most window.
- window - An alternative for
the name of the current window.
Methods
- alert (message)-Displays message in
a dialog box.
- blur() - Removes focus from the
window. On many systems, this sends the window to
the background. [Not 2|I]
- close() - Closes the window. [Not I]
- confirm (iaessage) - Displays message in
a dialog box with OK and CANCEL buttons. Returns
true or false based on the button clicked
by the user.
- focus() - Gives focus to the window. On
many systems, this brings the window to the
front. [Not 2 i I]
- navigator(uri) - Loads uri in the
window. [Not 2131
- open (url, name, features) - Opens uri
in a window named name. If name doesn't
exist, a new window is created with that name. features
is an optional string argument containing a
list of features for the new window. The feature
list contains any of the following name-value
pairs separated by commas and without additional
spaces: [Not I]
toolbar=[yes,no,1,0] Indicates
whether the window should have a toolbar
location=[yes,no,1,01 Indicates whether the
window should have a location field
directories=[yes,no,1,01 Indicates whether the
window should have directory buttons
status=[yes,no,1,01 Indicates whether the window
should have a status bar
menubar=[yes,no,1,01 Indicates whether the window
should have menus
scrollbars=[yes,no,1,01 Indicates whether the
window should have scrollbars
resizable=[yes,no,1,01 Indicates whether 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
- prompt(message,response) -
Displaysmessageinadialogboxwithatext entry field
with the default value of response. The
user's response in the text entry field is
returned as a string.
- settimeout (expression, time)-Evaluates
expression after time where time is a
value in milliseconds. The time-out can be named
with the structure name =
setTimeOut(expression,time)
- scroll(x,y) - Scrolls the window to the
coordinate x,y. [Not 2 1 I]
- clearTimeout(nawe) - Cancels the time-out
with the name name.
Event Handlers
- onBlur - Specifies JavaScript
code to execute when focus is removed from a
window. [Not 2|I]
- onError - Specifies JavaScript code to
execute when a JavaSciipt error occurs while
loading a document. This can be used to intercept
JavaScript errors. Setting this event handler to
null effectively prevents JavaScript errors from
being displayed to the user. [Not 2 1 1]
- onFocus - Specifies JavaScript code to
execute when the window receives focus. [Not 2 1
1]
- onLoad - Specifies JavaScript code to
execute when the window or frame finishes
loading.
- onunload - Specifies JavaScript code to
execute when the document in the window or frame
is exited.
Independent Functions and Operators
lndependentfunctions
- callc(FunctionNawe, arguments ...
) - Calls the external function Func,tjonNatne and
passes the arguments to it. [sj
or frame. [81
- debug(expression) - Displays the
result of expression to the trace window
- escape(character) - Returns a string containing the ASCIl
encoding,f character
in the form -.xx where xx is the
numeric encoding of the character. [C|2|3|I]
- eval(expressjon) - Returns the result of
evaluating expression where expression is
an arithmetic expression. [C|S|2|3|I]
- f""() - Displays buffered data from previous write of
unctionealls.[8]
- lsNaN(value) - Evaluates value to see
if it is NaN. Returns a boolean value.
[C|S|2|3|I] [On UNIX platforms, Not 2]
- ParseFloat(string) - Converts string to
a floating-point number and returns the value. It
continues to convert until it hits a non-numeric
character and then returns the result. If the
first character can't be converted to a number,
the function returns NaN (zero on Windows
platforms). [C 1 S 1213 1 1]
- parseint(string,base) - Converts string to
an integer of base base and returns the
value. It continues to convert until it hits a
non-numeric character and then returns the
result. If the first character canpt be converted
to a number, the function returns NaN (zero on
Windows platforms). [C i 8 12 i 3 1
11
- redirect(uri) - Redirects the client to url.
[S]
- registerCFunction(FunctionName, library,
externalNan7e) - Registers the external
function externalname in the library
specified by library and assigns it the
internal name FunctionName. [S]
- taint (propertyname) - Adds tainting
to propertynaine. [C 1 31
- tostring() - This is a method of
all objects. It returns the object as a string or
returns [ ob i ect type 1 if no string
representation exists for the object. [C 1 2 1 31
- unescape (string) - Returns a character
based on the ASCII encoding contained in string.
The ASCII encoding should take the form
%integer or hexadecimalvalue. [C 1 2 1 3 1 I]
- untaint (propertyName) - Removes tainting
from propertynaine. [Cl 3]
Operators
- Assignment operators-Table B. 1 shows assignment
operators in JavaScript. [C|2|3|I]
Table B.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. |
- Arithmetic operators - Table B.2 shows arithmetic
operators in JavaScript. [C|2|3|I]
Table B.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). |
- |
the operand. |
- Bitwise operators-Bitwise operators deal with
their operands as binary numbers but return
JavaScript numerical values (see Table B.3).
[C|2|3|I]
- Table B.3. Bitwise operators.
Operator |
Description |
AND (or &) |
Converts operands to integers with 32
bits, pairs the corresponding bits, and
returns 1 for each pair of ones. Returns
0 for any other combination. |
OR (or |) |
Converts operands to integers with 32
bits, pairs the corresponding bits, and
returns 1 for each pair where one of the
two bits is 1. Returns 0 if both bits are
0. |
XOR (or ^) |
Converts operands to integers with 32
bits, pairs the corresponding bits, and
returns 1 for each pair where only one
bit is 1. Returns 0 for any other
combination. |
<< |
Converts the left operand to an
integer with 32 bits and shifts bits to
the left of the number of bits indicated
by the right operand. Bits shifted off to
the left are discarded, and os are
shifted in from the right. |
>>> |
Converts the left operand to an
integer with 32 bits and shifts bits to
the right of the number of bits indicated
by the right operand. Bits shifted off to
the right are discarded, and os are
shifted in from the left. |
>> |
Converts the left operand to an
integer with 32 bits and shifts bits to
the right of 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. |
- Logical operators-Table B.4 shows logical
operators in JavaScript. [C|2|3|I]
Table B.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 f alse 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.
- Comparison operators-Table B.5 shows
comparison operators in JavaScript. [C
1213 1 11
Table B.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.
* Conditional operators-Conditional
expressions take one form:
(condition) ? vall : val2
If condi ti on is true, the
expression evaluates to val 1;
otherwise, it evaluates to val2. [C
12 1 3 1 I]
* String operators-The coneatenation
operator (+) is one of two string
operators. It evaluates to a string
combining the left and right operands.
The coneatenation assignment operator
(+=) is also available. [C 1213 1 11
* The typeof operator-The typeof
operator returns the type of its single
operand. Possible types are object,
string, number, boolean, function, and
undef ined. [C|3|I]
The void operator-The void operator
takes an expression as an operand
but returns no value. [C i 31
- Operator precedence - JavaScript applies the
rules of operator precedence as follows (from
lowest to highest precedence):
comma (,)
assignment operators (= += -= *= /= %=)
conditional (? :)
logical or (||)
logical and (&&)
bitwise or (:)
bitwise xor
bitwise and
equality(==)
relational (< <= > >=)
shift (<< >> >>>)
addition/subtraction (+)
multiply/divide/modulus 96)
negation/increment/decrement (! - ++ --)
call, member (() [])
JavaScript Statements
- break - Terminates the current
loop. [C|S|2|3|I]
- continue-4umps to the start of the next
iteration of the current loop. [C|S|2|3|I]
- for(.initial, condition,
lncreinent)-Creates a loop that counts
from intial by the steps specified by increment
until condition is true. [C|S|2|3|I]
- for(variable in object)-Loop
iterates through every property of object and
reflects them in variable inside the loop.
[C|S|2|3|I]
- function-Defines a function. [C|S|2|3|I]
- if (condition) JavaScrlptCode else
OtherCode-If condition is true, Javascriptcode
is executed; otherwise, Othercode is
executed. [C|S|2|3|I]
- new - Creates an instance of an
object. [C|S|2|3|I]
- return - Returns a value from a
function. [C|S|2|3|I]
- this - A reference to the current object.
[C|S|2|3|I]
- var - Declares a variable.
[C|S|2|3|I]
- while (condition) - A loop that
iterates as long as condition is true.
- with (object) JavaScriptCode - Sets
bject as the default object for JavaScriptCode.
|