Section 26.5. The Browser Object


26.5. The Browser Object

Finally, you should at least briefly consider the Browser Object Model or Browser Object. Using JavaScript, you can not only read and control the page and its contents, but also read and adjust properties of the browser displaying it. This can be in the form of resizing the window, or simply getting the value of the URI displayed in the address bar. Table 26-6 summarizes a few of the common properties and methods available to you in the Browser Object, which is accessed programmatically as window.

Table 26-6. Browser Object properties and methods

Property/method

Description

event

Represents the state of an event

history

Contains the URLs the user has visited within a browser window

location

Gives read/write access to the URI in the address bar

opener

Sets or returns a reference to the window that created the window

parent

Returns the parent window

screenLeft

Returns the x-coordinate of the upper-left corner of the browser relative to the upper-left corner of the screen

screenTop

Returns the y-coordinate of the top corner of the browser relative to the top corner of the screen

status

Sets or returns the text in the status bar of the window

alert( )

Displays an alert box with a specified message and an OK button

close( )

Closes the current window

confirm( )

Displays a dialog box with a specified message and an OK and a Cancel button

focus( )

Sets focus on the current window

open( )

Opens a new browser window

print( )

Prints the contents of the current window

setTimeout( )

Calls a function or evaluates an expression after a specified number of milliseconds





Web Design in a Nutshell
Web Design in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))
ISBN: 0596009879
EAN: 2147483647
Year: 2006
Pages: 325

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net