Percia Nancy Percia Nancy - 2 months ago 20
Javascript Question

Multiple Windows using window.open()

So as we all know if you click on a submit button that has embedded in it a "onClick(windown.open(...))" this opens a new window with all the lovely attributes you specify. However if then proceed to click on teh parent window and again click on the 'submit' button wihtout closing the previous popup window, then that same window is overwritten with the new data.

Now I need a way for that "window.open()" script to create new windows everytime it is clicked. SO in theory I could click the parent "submit" button 2 consecutive times and have 2 different child windows appear.

I'm sure it's trivial but I can't seem to find anything.

thanks in advance,
nancy

Answer

try this,it will create new child, fiddle

var randomnumber = Math.floor((Math.random()*100)+1); 
 window.open(yoururl,"_blank",'PopUp',randomnumber,'scrollbars=1,menubar=0,resizable=1,width=850,height=500');