Java Reference
In-Depth Information
Controlling Windows
A new window can be opened using the method. This takes the URL of
the page to be opened as its first parameter, and a list of attributes as the second parameter.
This can also be assigned to a variable, so the window can then be referenced later in the
popup ='','SitePoint','width=400,
The window.close() method can be used to close a window:
It is also possible to move a window using the window.move() method. This takes two
parameters that are the X and Y coordinates of the screen that the window is to be moved to:
window.moveTo(0,0); // will move the window to the top-left
of the screen
You can resize a window using the window.resizeTo() method. This takes two para-
meters that specify the width and height of the resized window's dimensions:
Warning: Avoid Popups!
These methods were largely responsible for giving JavaScript a bad name as
they were used for creating annoying pop-up windows. It's also a bad idea
from a usability standpoint to resize or move a user's window.
Many browsers block pop-up windows and disallow some of these methods
to be called in certain cases. For example, you can't resize a window if more
than one tab is open.
Search WWH ::

Custom Search