JAVASCRIPT UTOPIA |
LOAD A URL FROM A POPUP WINDOW |
load a url from a popup window
if you've popped up a window using a popup window script and loaded a page into that popped-up window, you may want to use links in the new window to load pages into the old window. not a problem. to load pages into the window that opened a popup window, follow these instructions...
step one: add the script
first put this little script inside the <head> tag of the page in the popped-up window:
step two: add the links
once you've got the above script in your page, make your links like this:
<a href="javascript:loadinparent('http://www.moock.org/', false);">my homepage</a>
<a href="javascript:loadinparent('http://www.moock.org/gwen/', false);">GWEN!</a>
<a href="javascript:loadinparent('http://www.moock.org/webdesign/javascript/', true);">javascript page</a>
here's how the links work: start with a normal anchor tag:
<A HREF=""></A>
as the value of the HREF attribute, add one of the following lines of code, setting the options as described below:
the above code samples each call the page loading function in the script you just put in your popped-up window page. we send two pieces of information to that function: 1)
javascript:loadinparent('yourlinkhere.html', false);
javascript:loadinparent('yourlinkhere.html', true);
'yourlinkhere.html'
, which is the location of the page you want loaded into the parent window; and 2) either true
or false
, which indicates whether or not the function should close the popped-up window after loading the page into the parent window (true
if it should close it, false
if it shouldn't).
and that's all there is to it!
try it out
here's a sample showing the code in action.