Assigning Property Values to Variables

Command Description
PageColor=document.bgColor; Assign the background color of the page
to the PageColor variable.
FrameNumber=window.length; Store the number of frames in the window
in the variable FrameNumber.
BrowserName=navigator.appName;   Save the name of the browser in the variable BrowserName.  

Examples of JavaScript Objects and Methods

Object Name Method Name Description
history.
history.
back( )
forward( )
Returns to the previous page in the history list
Goes to the next page in the history list
form.
form.
reset( )
submit( )
Resets the form
Submits the form
document.
document.
write(string)
writeln(string)
Writes text and HTML tags to the current document
Writes text and HTML to the current document on a new line  
frame.
frame.
frame.
alert(message)
close( )
prompt(message, default_text)
Displays a dialog box with a message in the frame
Closes the frame
Displays a dialog box prompting the user for information
window.
window.
window.
window.
alert(message)
close( )
prompt(message, default_text)
scroll(x, y)
Displays a dialog box with a message in the window
Closes the window
Displays a dialog box prompting the user for information
Scrolls to the (x,y) coordinate in the window

Responding to Events with Event Handlers

Object     Names of Event Handlers      
button onClick
check box onClick
document   onLoad, onUnload, onError      
form onSubmit, onReset
frames onBlur, onFocus
hyperlink onClick, onMouseOver, onMouseOut
image   onLoad, onError, onAbort  
image map hotspot onMouseOver, onMouseOut
input box   onBlur, onChange, onfocus, onSelect  
radio button onClick
reset button   onClick  
selection list onBlur, onChange, onFocus
submit button   onClick  
text area box onBlur, onChange, onFocus, onSelect
window   onLoad, onUnload, onBlur, onFocus