11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Event Description<br />

onafterprint Event triggered after the window is<br />

printed.<br />

onbeforeprint Fires just before the window is printed or<br />

print previewed.<br />

onbeforeunload <strong>The</strong> event is triggered just before the<br />

window unloads. Should happen before<br />

the onunload event.<br />

ondragdrop Is triggered when a document is dragged<br />

onto a window. (Netscape only.)<br />

onhelp Fires when the Help key, generally F1, is<br />

clicked.<br />

onresizeend Fires when the resize process ends—<br />

usually the user has stopped dragging<br />

the corner of a window.<br />

onresizestart Fires when the resize process begins—<br />

usually the user has started dragging the<br />

corner of a window.<br />

onscroll Fires when the window is scrolled in<br />

either direction.<br />

Frames: A Special Case of Windows<br />

A common misunderstanding among Web developers is the relationship between frames and<br />

windows. In reality, both from the perspective of (X)HTML and <strong>JavaScript</strong>, each frame shown<br />

on screen is a window that can be manipulated. In fact, when a browser window contains<br />

multiple frames, it is possible to access each of the separate window objects through<br />

window.frames[], which is an array of the individual frames in the window. <strong>The</strong> basic properties<br />

useful for manipulating frames are detailed in Table 12-4. Notice how many of them are related<br />

to the reserved frame values used in (X)HTML.<br />

Table 12-4: Common Window Properties Related to Frames<br />

Window Property Description<br />

frames[] An array of all the frame objects contained by the current window.<br />

length <strong>The</strong> number of frames in the window. Should be the same value<br />

as window.frames.length.<br />

name <strong>The</strong> current name of the window. This is both readable and<br />

settable since <strong>JavaScript</strong> 1.1.<br />

parent A reference to the parent window.<br />

self A reference to the current window.<br />

top A reference to the top window. Often the top and the parent will<br />

be one and the same unless the tag loads documents<br />

containing more frames.<br />

window Another reference to the current window.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!