View Full Version : New window from a new window

Feb 14th, 2007, 09:10 AM
Hi all.

Ok firstly let me point out that js is all new to me. But I have this script:

function popup(url) {
mywindow = window.open(url, 'name', 'resizable=0, scrollbars=0, height=600, width=728');
return false;

Which creates a new window with this: <a href="#" onclick="popup('advert_popup.php')">Launch popup</a>

But within this new window I wish to create another new window link with this

function picwindow(url) {
mywindow2 = window.open(url, 'name', 'resizable=0, scrollbars=0, height=480, width=640');
return false;

and the link: <div id="popup_magnify"><a href="#" onclick="picwindow('big_pic.php')"><img src="images/magnifying_glass.png" alt="magnifying glass" /></a></div>

What happens is that the new page 'big_pic.php' does not open in a new window but replaces the contents of the original window.

Basically everytime I create a popup window link I want a new window to appear but leaving the old one behind.

Any ideals?

Feb 14th, 2007, 01:00 PM
coz u have the same name
window.open(url, 'name'...) try giving it a different name or make it a parameter to the function

Feb 14th, 2007, 01:22 PM
Many thanks