This will explain one way of making a popup window. There are more ways of doing it, and different schools of thought on each one. This is my way, if you don't like it, you can do it your way.
If you open a window at 200x200 pixels, and then try to open another window at 300x300 pixels, the window will not grow in size. The first window must be closed completely.
Making modifications to the names of the windows, which solves the problem of the above problem, destroys the close code. In that case, only provide tools for closing windows from within themselves using self.close()
To use the code, you must invoke this JavaScript function with 3 parameters.
pop(url, width, height);
url
This is the page that you want to go to. It may be a relative link or absolute
http://www.google.com/
/images/myimage.jpg
docs/folder.php
width
This is an integer value in pixels that the window width should be. The measurement is the viewable page space on most web browsers. The browser may add width to the actual window size depending on operating system etc. If scroll bars display, they will cut into the page area.
height
This is an integer value in pixels that the window height should be. The measurement is the viewable page space on most web browsers. The browser will add height to the actual window size to display page title and window management features. If a scroll bar displays, it will cut into the page area.
because we named this window popup, we can invoke the close() method on it at any time, from any window.
Try this example if you have this pages popup open.
Optionally from within the popup you can also use self.close(); which will close whichever window the link is in.
Copyright (C) 2000-2010, Erik Giberti (AF-Design), All rights reserved.
Program as used in this license may refer to entire software packages, code snippets and binary image or visual information.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA