↑
Main Page
Manipulating windows
Figure 5-5
Manipulating windows
As mentioned previously, the
window
object is useful to manipulate browser windows (and frames),
which means as a developer, you are able to move and resize browser windows. Four methods are avail-
able to accomplish this:
?
moveBy(
dx
,
dy
) — moves the browser window
dx
pixels horizontally and
dy
pixels verti-
cally relative to its current position. Negative numbers can be used for
dx
to move the window
to the left and for
dy
to move the window up.
?
moveTo(
x
,
y
) — moves the browser window so that its upper-left corner is located at position
(
x
,
y
) on the user ’s screen. Negative numbers can be used, but these move part of the window
off of the visible screen.
?
resizeBy(
dw
,
dh
) — resizes the browser window’s width by
dw
pixels and its height by
dh
pixels relative to the window’s current size. Negative numbers can be used for
dw
to shrink the
window’s width and for
dh
to shrink the window’s height.
139
JavaScript in the Browser
08_579088 ch05.qxd 3/28/05 11:37 AM Page 139
Free JavaScript Editor
Ajax Editor
©
→