Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
82 views

Javascript Object Reference: Objects

This document provides a summary of various JavaScript objects that can be used for programming. It lists objects like Anchor, Applet, Array, Boolean, Button, Checkbox, Date, and others. For each object, it provides the object's properties and methods to control or access aspects of that object. The document is intended to make programming with JavaScript objects easier.

Uploaded by

vidyanathreddy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views

Javascript Object Reference: Objects

This document provides a summary of various JavaScript objects that can be used for programming. It lists objects like Anchor, Applet, Array, Boolean, Button, Checkbox, Date, and others. For each object, it provides the object's properties and methods to control or access aspects of that object. The document is intended to make programming with JavaScript objects easier.

Uploaded by

vidyanathreddy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 19

JavaScript Object Reference

JavaScript has a wide variety of objects you can use when programming, and each of
them have different properties you can control or display through the use of methods.
This table should make your programming jobs in JavaScript a little easier.

Objects

Anchor Frame Location RegExp


Applet Function Math Reset
Array Hidden MimeType screen
Boolean History Navigator Select
Button Image netscape String
Checkbox Java Number Style
Date JavaArray Object Submit
document JavaClass Option Sun
event JavaObject Packages Text
FileUpload JavaPackage Password Textarea
form Layer Plugin window
Link Radio

JavaScript Object Reference - Anchor


An anchor is a place in the page that is the target of a link.

Anchor
Properties
Name Description Ver.
name Specifies the anchor's name. 1.2
text Specifies the text of an anchor. 1.2
x Pixels from the left edge of the document. 1.2
y Pixels from the top edge of the document. 1.2

JavaScript Object Reference - Applet


Applet
Properties
Name Description Ver.
The Applet object inherits all public properties of the Java applet.
Methods
Name Description Ver.
The Applet object inherits all public methods of the Java applet.

JavaScript Object Reference - Array


An array is a list of elements indexed sequentially starting at zero. JavaScript array
elements, as with their variables, can be of differing types.

Array
Properties
Name Description Ver.
constructor The function that creates and object's 1.1
prototype.
index Reflects original string against what the regular 1.1
expression matched.
input For an array created by a regular expression 1.1
match, reflects the original string against that
which the regular expression was matched.
length The number of elements in an array. 1.3
prototype Allows the addition of properties to all objects. 1.1
Methods
Name Description Ver.
concat Combines two arrays and returns a new array. 1.1
join Joins all elements of an array into a string. 1.1
pop Removes the last element from an array and 1.1
returns that element.
push Adds elements to the end of an array and 1.3
returns the array's length.
reverse Makes the first element the last and vise-versa. 1.1
shift Takes away 1st element and returns the 1.1
element.
slice Takes a section out of an array and returns a 1.1
new array.
splice Adds or removes elements in an array. 1.3
sort Sorts the elements in an array. 1.1
toSource Used to to create a new array. Overrides the 1.3
Object.toSource method.
toString Returns a string representing the array and its 1.1
elements. Overrides the Object.toString
method.
unshift Adds elements to the front of the array and 1.1
returns its new length.
valueOf Returns the primitive value of the array. 1.1
Overrides the Object.valueOf method.
JavaScript Object Reference - Boolean
Boolean
Properties
Name Description Ver.
constructor Specifies the function that creates an object's 1.1
prototype.
prototype Defines a property that is shared by all Boolean 1.1
objects.
Methods
Name Description Ver.
toSource Use this value to create a new object. Overrides 1.3
the Object.toSource method.
toString Returns a string representing the defined 1.1
object. Overrides the Object.toString method.
valueOf Returns the primitive value of a Boolean object. 1.1
Overrides the Object.valueOf method.
JavaScript Object Reference - Button
Button
Properties
Name Description Ver.
form Defines what form contains the button object. 1.0
name Name of the button. 1.0
type Type of the button. 1.1
value Value of the form. 1.0
Methods
Name Description Ver.
blur Takes focus off the button. 1.1
click Simulates a mouse click on the button. 1.0
focus Puts focus on the button. 1.1
handleEvent Invokes the handler for the specified event. 1.2
JavaScript Object Reference - Checkbox
Checkbox
Properties
Name Description Ver.
checked Boolean property that reflects the state of 1.0
the checkbox.
defaultChecked Boolean property that reflects the 1.0
CHECKED attribute.
form Defines what form contains the button 1.0
object.
name Name of the button. 1.0
type Type of the button. 1.1
value Value of the form. 1.0
Methods
Name Description Ver.
blur Takes focus off the button. 1.1
click Simulates a mouse click on the button. 1.0
focus Puts focus on the button. 1.1
handleEvent Invokes the handler for the specified event. 1.2
JavaScript Object Reference - Date
Date
Date
Name Description Ver.
constructor Specifies function that creates an 1.0
object's prototype.
prototype Allows additional properties to a Date 1.0
object.
Methods
Name Description Ver.
getDate Returns day of the month from your 1.0
local time.
getDay Returns day of the week from your 1.0
local time.
getFullYear Returns the year from your local time. 1.3
getHours Returns the hour from your local time. 1.0
getMilliseconds Returns the milliseconds from your 1.3
local time.
getMinutes Returns the minutes from your local 1.0
time.
getMonth Returns the month from your local 1.0
time.
getSeconds Returns the seconds from your local 1.0
time.
getTime Returns the numeric value for the time 1.0
from your local time.
getTimezoneOffset Returns the time-zone offset in 1.0
minutes from your local time.
getUTCDate Returns day of the month according to 1.3
universal time.
getUTCDay Returns day of the week according to 1.3
universal time.
getUTCFullYear Returns the year according to 1.3
universal time..
getUTCHours Returns the hour according to 1.3
universal time..
getUTCMilliseconds Returns the milliseconds according to 1.3
universal time..
getUTCMinutes Returns the minutes according to 1.3
universal time..
getUTCMonth Returns the month according to 1.3
universal time..
getUTCSeconds Returns the seconds according to 1.3
universal time..
getYear Returns the date from your local time. 1.0
parse Number of milliseconds in a date string 1.0
since January 1, 1970, 00:00:00, local
time.
setDate Sets the day of the month from your 1.0
local time.
setFullYear Sets the year from your local time. 1.3
setHours Sets the hour from your local time. 1.0
setMilliseconds Sets the milliseconds from your local 1.3
time.
setMinutes Sets the minutes from your local time. 1.0
setMonth Sets the month from your local time. 1.0
setSeconds Sets the seconds from your local time. 1.0
setTime Sets the numeric value for the time 1.0
from your local time.
setUTCDate Sets day of the month according to 1.3
universal time.
setUTCFullYear Sets the year according to universal 1.3
time..
setUTCHours Sets the hour according to universal 1.3
time..
setUTCMilliseconds Sets the milliseconds according to 1.3
universal time..
setUTCMinutes Sets the minutes according to 1.3
universal time..
setUTCMonth Sets the month according to universal 1.3
time..
setUTCSeconds Sets the seconds according to 1.3
universal time..
setYear Sets year for a specified date from 1.3
your local time.
toGMTString Converts a date to a string, using the 1.0
Internet GMT conventions.
toLocaleString Converts a date to a string, using the 1.0
current location's conventions.
toSource Use this value to create a new object. 1.3
Overrides the Object.toSource method.
toString Returns a string representing the 1.0
specified Date object. Overrides the
Object.toString method.
toUTCString Converts a date to a string, using the 1.0
universal time convention.
UTC Returns the number of milliseconds in 1.0
a Date object since January 1, 1970,
00:00:00, universal time.
valueOf Returns the primitive value of a Date 1.0
object. Overrides the Object.valueOf
method.
JavaScript Object Reference - document
document
Properties
Name Description Ver.
alinkColor Specifies the ALINK attribute. 1.0
anchors Contains an entry for each anchor in the 1.0
document.
applets Array that contains an entry for each applet 1.1
in the document.
bgColor A string that specifies the BGCOLOR 1.0
attribute.
classes Creates a Style object that can specify a 1.2
specific CLASS attribute.
cookie Specifies a cookie. 1.0
domain Specifies the domain name of the server 1.0
that served a document.
embeds An array containing an entry for each plug-in 1.1
in the document.
fgColor A string that specifies the TEXT attribute. 1.0
formName A separate property for each named form in 1.1
the document.
forms An array a containing an entry for each form 1.1
in the document.
height The height of the document, in pixels. 1.0
ids Creates a Style object that can specify the 1.2
style of individual HTML tags.
images An array containing an entry for each image 1.0
in the document.
lastModified A string that specifies the date the document 1.0
was last modified.
layers Array containing an entry for each layer 1.2
within the document.
linkColor A string that specifies the LINK attribute. 1.0
links An array containing an entry for each link in 1.0
the document.
plugins An array containing an entry for each plug-in 1.1
in the document.
referrer A string that specifies the URL of the calling 1.0
document.
tags Creates a Style object that can specify the 1.2
styles of HTML tags.
title A string that specifies the contents of the 1.0
TITLE tag.
URL A string that specifies the complete URL of a 1.0
document.
vlinkColor A string that specifies the VLINK attribute. 1.0
width The width of the document, in pixels. 1.0
Methods
Name Description Ver.
captureEvents Sets the document to capture all events of 1.2
the specified type.
close Closes an output stream and forces data to 1.0
display.
contextual Uses selection criteria to specify a Style 1.2
object that can set the style of HTML tags.
getSelection Returns a string containing the text of the 1.2
selection.
handleEvent Invokes the handler for the specified event. 1.2
open Opens a stream to collect the output of write 1.0
or writeln methods.
releaseEvents Sets the window or document to release 1.2
captured events of the specified type,
sending the event to objects further along
the event hierarchy.
routeEvent Passes a captured event along the normal 1.2
event hierarchy.
write Writes HTML expressions to a document in 1.0
the specified window.
writeln Writes HTML expressions to a document in 1.0
the specified window and follows them with
a newline character.
JavaScript Object Reference - event
event
Properties
Name Description Ver.
data Passes an array of strings containing the URLs of 1.2
the dropped objects to the DragDrop event.
height Represents the height of the window or frame. 1.2
layerX Number specifying either the object width when 1.2
passed with the resize event, or the cursor's
horizontal position in pixels relative to the layer in
which the event occurred.
layerY Number specifying either the object height when 1.2
passed with the resize event, or the cursor's
vertical position in pixels relative to the layer in
which the event occurred.
modifiers String specifying the modifier keys associated 1.2
with a mouse or key event.
pageX Number specifying the cursor's horizontal position 1.2
in pixels on the page.
pageY Number specifying the cursor's vertical position in 1.2
pixels on the page.
screenX Number specifying the cursor's horizontal position 1.2
in pixels on the screen.
screenY Number specifying the cursor's vertical position in 1.2
pixels on the screen.
target String representing the object to which the event 1.2
was originally sent.
which Number specifying either the mouse button that 1.2
was pressed or the ASCII value of a pressed key.
For a mouse, 1 is the left button, 2 is the middle
button, and 3 is the right button.
width The width of the window or frame. 1.2
x layerX. 1.2
y layerY. 1.2
1.2
JavaScript Object Reference - FileUpload
FileUpload
Properties
Name Description Ver.
form Specifies the form containing the FileUpload 1.0
object.
name NAME attribute of the form. 1.0
type TYPE attribute of the form. 1.1
value Reflects the current value of the file upload 1.0
element's field.
Methods
Name Description Ver.
blur Takes focus off the object. 1.0
focus Puts focus on the object. 1.0
handleEvent Invokes the handler for the event. 1.2
select Selects the input area of the file upload field. 1.0
JavaScript Object Reference - form
form
Properties
Name Description Ver.
action ACTION attribute. 1.0
elements An array reflecting all the elements in a form. 1.0
encoding ENCTYPE attribute. 1.0
length Reflects the number of elements on a form. 1.0
method METHOD attribute. 1.0
name NAME attribute. 1.0
target TARGET attribute. 1.0
Methods
Name Description Ver.
handleEvent Invokes the handler for the specified event. 1.2
reset Simulates a mouse click on a reset button for 1.1
the calling form.
submit Submits a form. 1.0
JavaScript Object Reference - Frame
Frame
Properties
Name Description Ver.
closed Specifies whether a window has 1.1
been closed or not.
crypto An object which allows access to 1.2
encryption features.
defaultStatus Default message displayed in the 1.0
browser's status bar.
document Information on the document, 1.0
provides methods for displaying
HTML output to the user.
frames An array that reflects all the frames 1.0
in a window.
history Contains information on the URLs 1.1
that the client has visited within a
window.
innerHeight Specifies the vertical dimension, in 1.2
pixels, of the window's content
area.
innerWidth Specifies the horizontal dimension, 1.2
in pixels, of the window's content
area.
length The number of frames in the 1.0
window.
location Information on the current URL. 1.0
locationbar Browser window's location bar. 1.2
menubar Browser window's menu bar. 1.2
name Unique name used to refer to this 1.0
window.
offscreenBuffering Specifies whether updates to a 1.2
window are performed in an
offscreen buffer.
opener Specifies the window name of the 1.1
calling document when a window is
opened using the open method.
outerHeight Specifies the vertical dimension, in 1.2
pixels, of the window's outside
boundary.
outerWidth Specifies the horizontal dimension, 1.2
in pixels, of the window's outside
boundary.
pageXOffset Provides the current x-position, in 1.2
pixels, of a window's viewed page.
pageYOffset Provides the current y-position, in 1.2
pixels, of a window's viewed page.
parent A synonym for a window or frame 1.0
whose frameset contains the
current frame.
personalbar Represents the browser window's 1.2
personal bar (also called the
directories bar).
screenX Specifies the x-coordinate of the 1.2
left edge of a window.
screenY Specifies the y-coordinate of the 1.2
top edge of a window.
scrollbars Represents the browser window's 1.2
scroll bars.
self Refers to the current window.
status Specifies a priority or transient
message in the window's status
bar.
statusbar Represents the browser window's
status bar.
toolbar Represents the browser window's
toolbar.
top Refers to the topmost browser
window.
window Refers to the current window.
Methods
Name Description Ver.
alert Displays an Alert dialog box with a
message and an OK button.
atob Decodes a string of data which has
been encoded using base-64
encoding.
back Undoes the last history step in any
frame within the top-level window.
blur Removes focus from the specified
object.
btoa Creates a base-64 encoded string.
captureEvents Sets the window or document to
capture all events of the specified
type.
clearInterval Cancels a timeout that was set with
the setInterval method.
clearTimeout Cancels a timeout that was set with
the setTimeout method.
close Closes the specified window.
confirm Displays a Confirm dialog box with
the specified message and OK and
Cancel buttons.
crypto.random Returns a pseudo-random string
whose length is the specified
number of bytes.
crypto.signText Returns a string of encoded data
which represents a signed object.
disableExternalCapture Disables external event capturing
set by the enableExternalCapture
method.
enableExternalCapture Allows a window with frames to
capture events in pages loaded
from different locations (servers).
find Finds the specified text string in the
contents of the specified window.
focus Gives focus to the specified object.
forward Loads the next URL in the history
list.
handleEvent Invokes the handler for the
specified event.
home Points the browser to the URL
specified in preferences as the
user's home page.
moveBy Moves the window by the specified
amounts.
moveTo Moves the top-left corner of the
window to the specified screen
coordinates.
open Opens a new web browser window.
print Prints the contents of the window
or frame.
prompt Displays a Prompt dialog box with
a message and an input field.
releaseEvents Sets the window to release
captured events of the specified
type, sending the event to objects
further along the event hierarchy.
resizeBy Resizes an entire window by
moving the window's bottom-right
corner by the specified amount.
resizeTo Resizes an entire window to the
specified outer height and width.
routeEvent Passes a captured event along the
normal event hierarchy.
scroll Scrolls a window to a specified
coordinate.
scrollBy Scrolls the viewing area of a
window by the specified amount.
scrollTo Scrolls the viewing area of the
window to the specified
coordinates, such that the specified
point becomes the top-left corner.
setHotKeys Enables or disables hot keys in a
window which does not have
menus.
setInterval Evaluates an expression or calls a
function every time a specified
number of milliseconds elapses.
setResizable Specifies whether a user is
permitted to resize a window.
setTimeout Evaluates an expression or calls a
function once after a specified
number of milliseconds has
elapsed.
setZOptions Specifies the z-order stacking
behavior of a window.
stop Stops the current download.
JavaScript Object Reference - Function
Function
Properties
Name Description Ver.
arguments The array of arguments passed to the function. 1.1
arity Specifies the number of arguments a functions 1.2
expects.
constructor Specifies the function that creates an object's 1.1
prototype.
length Specifies the number of arguments expected by 1.1
the function.
prototype Allows the addition of properties to a function 1.1
object.
Methods
Name Description Ver.
apply Allows you to apply a method of another object 1.3
in the context of a different object.
call Allows you to execute a method of another 1.3
object in the context of a different object.
toSource Returns a string representing the source code 1.3
of the function.
toString Returns a string representing the source code 1.1
of the function.
valueOf Returns a string representing the source code 1.1
of the function.
JavaScript Object Reference - Hidden
Hidden
Properties
Name Description Ver.
form Specifies the form containing the Hidden object. 1.0
name Reflects the NAME attribute. 1.1
type Reflects the TYPE attribute. 1.1
value Reflects the current value of the Hidden object. 1.0
JavaScript Object Reference - History
History
Properties
Name Description Ver.
current Specifies the URL of the current history entry. 1.1
length Reflects the number of entries in the history list. 1.0
Next Specifies the URL of the next history entry. 1.1
previous Specifies the URL of the previous history entry. 1.1
Methods
Name Description Ver.
back Loads the previous URL in the history list. 1.0
forward Loads the next URL in the history list. 1.0
Go Loads a URL from the history list. 1.0
JavaScript Object Reference - Image
Image
Properties
Name Description Ver.
border Reflects the BORDER attribute. 1.1
complete Boolean value indicating whether the web 1.1
browser has completed its attempt to load the
image.
height Reflects the HEIGHT attribute. 1.1
hspace Reflects the HSPACE attribute. 1.1
lowsrc Reflects the LOWSRC attribute. 1.1
name Reflects the NAME attribute. 1.1
Src Reflects the SRC attribute. 1.1
vspace Reflects the VSPACE attribute. 1.1
width Reflects the WIDTH attribute. 1.1
Methods
Name Description Ver.
handleEvent Invokes the handler for the specified event. 1.1
JavaScript Object Reference - Java
Java
Properties
Methods
The java object is a top-level, predefined JavaScript object.
You can automatically access it without using a constructor or
calling a method.

JavaScript Objects
This is a table of the most commonly used JavaScript objects, with all of their properties,
methods, and event handlers.

For additional information on JavaScript:

 Visit Netscape's JavaScript Documentation, which has a complete listing of these


objects as well as loads of other information on the JavaScript spec.
Hierarchy Objects
Object Properties Methods Event Handlers
Window defaultStatus alert onLoad
frames blur onUnload
opener close onBlur
parent confirm onFocus
scroll focus
self open
status prompt
top clearTimeout
window setTimeout
Frame defaultStatus alert none (The onLoad and onUnload
frames blur event handlers belong to the
opener close Window object)
parent confirm
scroll focus
self open
status prompt
top clearTimeout
window setTimeout
Location hash reload none
host replace
hostname
href
pathname
por
protocol
search
History length back none
forward
go
Navigator appCodeName javaEnabled none
appName
appVersion
mimeTypes
plugins
userAgent
document alinkColor clear none (the onLoad and onUnload
anchors close event handlers belong to the
applets open Window object.
area write
bgColor writeln
cookie
fgColor
forms
images
lastModified
linkColor
links
location
referrer
title
vlinkColor
image border none none
complete
height
hspace
lowsrc
name
src
vspace
width
form action submit onSubmit
elements reset onReset
encoding
FileUpload
method
name
target
text defaultValue focus onBlur
name blur onCharge
type select onFocus
value onSelect

Built-in Objects
Array length join none
reverse
sort xx
Date none getDate none
getDay
getHours
getMinutes
getMonth
getSeconds
getTime
getTimeZoneoffset
getYear
parse
prototype
setDate
setHours
setMinutes
setMonth
setSeconds
setTime
setYear
toGMTString
toLocaleString
UTC
String length anchor Window
prototype big
blink
bold
charAt
fixed
fontColor
fontSize
indexOf
italics
lastIndexOf
link
small
split
strike
sub
substring
sup
toLowerCase
toUpperCase

You might also like