HTML and CSS Reference
In-Depth Information
EXAMPLE
13.7 (
CONTINUED
)
</form>
</body>
</html>
EXPLANATION
1
A user-defined function, called
newWindow()
, will create a new
window
object
with the
window
object's
open()
method, specified with a number of options to
further define the window.
2
The new
window
object contains an image called
summertime.jpg
.
3
The new window is moved to the left corner of the screen, pixel position (0,0).
4
The new window gets focus. It will be on top of all the other windows.
5
This user-defined function is responsible for closing the new window.
6
The
close()
method of the
window
object causes the new window to be closed.
7
When the user clicks this button, the
onClick
event handler is triggered, and a new
window will be opened.
8
When the user clicks this button, the
onClick
event handler is triggered, and the
new window will be closed. The output is shown in Figures 13.7 and 13.8.
Figure 13.7
The parent window.
Figure 13.8
The new window is in focus and will appear on top of its parent window.