(Last Updated 11/1/98)
Java Script PopUp Window II
![](../Special/wavy.gif)
Pop-Up windows have many ways they can be used. The previous page illustrated their
use as links activated by mouse actions. This page shows their use in providing
an illusion of activity for long load pages. In the example shown, the window is
activated by code located at the top of the page just after the page title is written.
(Remember, HTML is processed line by line in the order its written. Therefore, this code
has to be at the beginning of the page to be useful. It could also have been written
as a function in the header of the page and activated by an"onLoad=popUpWindowFunctionName()"command
in the BODY tag.)
![](../Sleepy/lep_new2.GIF)
(Picture drawn by DeAnna Krusman.)
I'm just watching this time.
The code to produce the effect is:
The most interesting item seen in this script is the use of variables.
The list of window propertities is defined in variable, "config", and placed above the "window.open"
statement. (All Java Script variables MUST be defined before they are referenced.)
Additionally, one of the propertities, the window width, was put in as a variable, "width1".
This use of variables was obviously not needed here and was done only to show it is possible to have the scripts
change dynamically. Although this case can hardly be called dynamic, it is easy to see the possibilities available.
Scripts can adapt themselves to the client's platform, browser, or JavaScript version; or as a response to some other event such
as the client's previous location, the data in a cookie, or how the script was initiated. The use of variables and conditional
choice (if ... then ... else ...) statements provides much of the power of Java Script.
In case anyone is wondering, the "+=" is a shorthand operator that has gotten popular recently. The equation x += y means:
for numbers: add y to x and assign the rsult to x
for strings: concatenate string y to the end of string x and assign the result to string x
![](../Special/wavy.gif)
Contact Carl Paulson with questions,
or Visit my pages.