JAVASCRIPT
POPUP
WINDOWS 2
[Requires a browser that supports JavaScript.]
§2 Open a new browser window and set its size.
<html> <head> <title>Popup Windows 2 </title> <script language="JavaScript"> <!-- Hide. function popup() { Pop=window.open("testpage.html","popone","width=250,height=400"); } // End hide. --> </script> </head> <body> <a href="#" onclick="popup()">popup window</a> <a href="#" onclick="Pop.close()">popup window</a> </body> </html>
Click the link in the right frame. When you're finished close the new popup window.
In this example
window.open()
is in a separate function
called
popup().
The function definition is enclosed by
<script>
tags and
is within the
<head>
tags. Note the use of quotation marks.
Pop is the name of the new window.
It is used to access properties and containers, and
call methods. It's used in the example to called the
close()
method. The name
popone
cannot
be used here (see previous topic).
The third argument to
window.open()
is the optional
feature list.
The height and width in pixels of the new window are specified.
Mentioning any feature turns off all the others.
Use
popone
to close the new window and see
the JavaScript error message.
Copyright © 2000 P.J. LaBrocca. http://LaBrocca.com