OBJECT: Window
As
the top level object in the JavaScript client hierarchy, every browser
window and frame has a corresponding Window object, created automatically
with every instance of a <BODY> or <FRAMESET> tag.
PROPERTIES
closed Property
This property is used to return a Boolean value that determines if a window
has been closed. If it has, the value returned is true.
Syntax: window.closed
defaultStatus Property
This property is used to define the default message displayed in a window's
status bar.
Syntax: window.defaultStatus(
= "message")
document Property
This property's value is the document object contained within the window.
See Document object.
Syntax: window.document
frames Property
This property is an array containing references to all the named child
frames in the current window.
Syntax: window.frames
( = "frameID")
history Property
This property's value is the window's History object, containing
details of the URL's visited from within that window. See History
object.
Syntax: window.history
innerHeight / innerWidth Properties
These properties determine the inner dimensions of a window's content
area.
Syntax: window.innerHeight
= pixelDimensions
window.innerWidth
= pixelDimensions
length Property
This property returns the number of child frames contained within a window,
and gives identical results as using the length property of the frames
array.
Syntax: window.length
location Property
This property contains details of the current URL of the window and its
value is always the Location object for that
window.
Syntax: window.location
locationbar Property
This property relates to the area of a browser's window that contains
the details of the URL or bookmark (this is where you physically enter
URL details). The locationbar property has its own property, visible,
that defaults to true (visible) and can be set to false (hidden).
Syntax: window.locationbar[.visible
= false]
menubar Property
This property relates to the area of a browser's window that contains
the various pull-down menus (File, Edit, View, etc.). The menubar property
has its own property, visible, that defaults to true (visible) and can
be set to false (hidden).
Syntax: window.menubar[.visible
= false]
name Property
This property is used to return or set a window's name.
Syntax: window.name
opener Property
When opening a window using window.open, use this property from the destination
window to return details of the source window. This has many uses, for
example, window.opener.close() will close the source window.
Syntax: window.opener
outerheight / outerwidth Property
These properties determine the dimensions, in pixels, of the outside boundary,
including all interface elements, of a window.
Syntax: window.outerheight
Syntax: window.outerwidth
pageXOffset / pageYOffset Property
These properties return the X and Y position of the current page in relation
to the upper left corner of a window's display area.
Syntax: window.pageXOffset
Syntax: window.pageYOffset
parent Property
This property is a reference to the window or frame that contains the
calling child frame.
Syntax: window.parent
personalbar Property
This property relates to the browser's personal bar (or directories bar).
The personalbar property has its own property, visible, that defaults
to true (visible) and can be set to false (hidden).
Syntax: window.personalbar[.visible
= false]
scrollbars Property
This property relates to the browser's scrollbars (vertical and horizontal).
The scrollbars property has its own property, visible, that defaults
to true (visible) and can be set to false (hidden).
Syntax: window.scrollbars[.visible
= false]
self Property
This property is a reference (or synonym) for the current active window
or frame.
Syntax: self.property
or method
status Property
This property, which can be set at any time, is used to define the transient
message displayed in a window's status bar such as the text displayed
when you onMouseOver a link or anchor.
Syntax: window.status(=
"message")
statusbar Property
This property relates to the browser's status bar. The statusbar property
has its own property, visible, that defaults to true (visible) and can
be set to false (hidden).
Syntax: window.statusbar[.visible
= false]
toolbar Property
This property sets or returns a Boolean value that defines whether the browser's tool bar is visible or not.
The default is true (visible). False means hidden.
It can only be set before the window is opened and you must have UniversalBrowserWrite privilege.
Syntax: window.toolbar[.visible
= false]
top Property
This property is a reference (or synonym) for the topmost browser window.
Syntax: top.property
or method
window Property
This property is a reference (or synonym) for the current window or frame.
Syntax: window.property
or method
METHODS
alert Method
This method displays an alert box containing a message and an o.k. button.
Syntax: window.alert("message")
back Method
Using this method is the same as clicking the browser's Back button, i.e.
it undoes the last navigation step performed from the current top-level
window.
Syntax: window.back(
)
blur Method
This method is used to remove focus from the current window.
Syntax: window.blur(
)
captureEvents Method
This method instructs the window to capture all events of a particular
type. See the event object for a list of event types.
Syntax: window.captureEvent(eventType)
clearInterval Method
This method is used to cancel a timeout previously set with the setInterval
method.
Syntax: window.clearInterval(intervalID)
clearTimeout Method
This method is used to cancel a timeout previously set with the setTimeout
method.
Syntax: window.clearTimeout(timeoutID)
close Method
This method is used to close a specified window. If no window reference
is supplied, the close() method will close the current active window.
Note that this method will only close windows created using the open()
method; if you attempt to close a window not created using open(), the
user will be prompted to confirm this action with a dialog box before
closing. The single exception to this is if the current active window
has only one document in its session history. In this case the closing
of the window will not require confirmation.
Syntax: window.close(
)
confirm Method
This method brings up a dialog box that prompts the user to select either
'o.k.' or 'cancel', the first returning true and the latter, false.
Syntax: window.confirm("message")
disableExternalCapture Method
This method disables the capturing of events previously enabled using
the enableExternalCapture method below.
Syntax: window.disableExternalCapture(
)
enableExternalCapture Method
This method allows a window that contains frames to capture events in
documents loaded from different servers.
Syntax: window.enableExternalCapture(
)
find Method
This method allows the searching of the contents of a window for a specified
string. The caseSensitive and backward arguments are Booleans
and to use either of these you must also specify the other. If a search
string is not supplied, JavaScript will display a Find dialog box which
prompts the user for a string to search for, and also provides the facility
to set the other two (caseSensitive and backward) arguments.
Syntax: window.find([string[,
caseSensitive, backward]])
focus Method
This method is used to give focus to the specified window. This is useful
for bringing windows to the top of any others on the screen.
Syntax: window.focus(
)
forward Method
Using this method is the same as clicking the browser's Forward button,
i.e. it goes to the next URL in the history list of the current top-level
window.
Syntax: window.forward(
)
handleEvent Method
This method is used to call the handler for the specified event.
Syntax: window.handleEvent("eventID")
home Method
Using this method has the same effect as pressing the Home button in the
browser, i.e. the browser goes to the URL set by the user as their home
page.
Syntax: window.home(
)
moveBy Method
This method is used to move the window a specified number of pixels in
relation to its current co-ordinates.
Syntax: window.moveBy(horizPixels,
vertPixels)
moveTo Method
This method moves the window's left edge and top edge to the specified
x and y co-ordinates, respectively.
Syntax: window.moveTo(Xposition,
Yposition)
open Method
This method is used to open a new browser window.
Syntax: window.open(URL,
name [, features])
print Method
This method is used to print the contents of the specified window.
Syntax: window.print(
)
prompt Method
This method displays a dialog box prompting the user for some input.
Syntax: window.prompt(message[,
defaultInput])
releaseEvents Method
This method is used to release any captured events of the specified type
and to send them on to objects further down the event hierarchy
Syntax: window.releaseEvents("eventType")
resizeBy Method
This method is used to resize the window. It moves the bottom right corner
of the window by the specified horizontal and vertical number of pixels
while leaving the top left corner anchored to its original co-ordinates.
Syntax: window.resizeBy(horizPixels,
vertPixels)
resizeTo Method
This method is used to resize a window to the dimensions supplied with
the outerWidth and outerHeight (both integers, in pixels)
parameters.
Syntax: window.resizeTo(outerWidth,
outerHeight)
routeEvent Method
This method is used to send a captured event further down the normal event
hierarchy; specifically, the event is passed to the original target object
unless a sub-object of the window (a document or layer) is also set to
capture this type of event, in which case the event is passed to that
sub-object.
Syntax: window.routeEvent(eventType)
scroll Method
This method is used to scroll the window to the supplied co-ordinates.
This method is now deprecated; use the scrollTo method detailed below
instead.
Syntax: window.scroll(coordsPixels)
scrollBy Method
This method is used to scroll the window's content area by the specified
number of pixels. This is only useful when there are areas of the document
that cannot be seen within the window's current viewing area, and the
visible property of the window's scrollbar must be set to true for this
method to work.
Syntax: window.scrollBy(horizPixels,
vertPixels)
scrollTo Method
This method scrolls the contents of a window, the specified co-ordinate
becoming the top left corner of the viewable area.
Syntax: window.scrollTo(xPosition,
yPosition)
setInterval Method
This method is used to call a function or evaluate an expression at specified
intervals, in milliseconds.
Syntax: window.setInterval(expression/function,
milliseconds)
setTimeout Method
This method is used to call a function or evaluate an expression after
a specified number of milliseconds.
Syntax: window.setTimeout(expression/function,
milliseconds)
stop Method
This method is used to cancel the current download. This is the same as
clicking the browser's Stop button.
Syntax: window.stop(
)
EVENT HANDLERS
onBlur Event handler
This event handler executes some specified JavaScript code on the occurrence
of a Blur event (when an window loses focus).
Syntax: window.onBlur="myJavaScriptCode"
onDragDrop Event handler
This event handler executes some specified JavaScript code on the occurrence
of a DragDrop event.
Syntax: window.onDragDrop="myJavaScriptCode"
onError Event handler
This event handler executes some specified JavaScript code on the occurrence
of an Error event.
Syntax: window.onError="myJavaScriptCode"
onFocus Event handler
This event handler executes some specified JavaScript code on the occurrence
of a Focus event.
Syntax: window.onFocus="myJavaScriptCode"
onload Event handler
This event handler executes some specified JavaScript code on the occurrence
of a Load event.
Syntax: window.onload="myJavaScriptCode"
onMove Event handler
This event handler executes some specified JavaScript code on the occurrence
of a Move event.
Syntax: window.onMove="myJavaScriptCode"
onResize Event handler
This event handler executes some specified JavaScript code on the occurrence
of a Resize event.
Syntax: window.onResize="myJavaScriptCode"
onUnload Event handler
This event handler executes some specified JavaScript code on the occurrence
of an Unload event.
Syntax: window.onUnload="myJavaScriptCode"
|