New popup on every click

I got a popup that opens with a script. Each time I click, I want to open a popup. I understand that a unique name for the window will solve the problem (in this case, "SampleWindow"). What is the best way to preserve the uniqueness of a window? Is there any other way to control javascript popup?

window.open(url, 'SampleWindow', 'WIDTH=300,HEIGHT=250');
+5
source share
3 answers

Passing the value _blankinto the parameter namewill load the passed URLinto a new window . Like this:

window.open(url, '_blank', 'width=300,height=250');

Other parameters for the parameter name(optional) include:

  • _blank. The URL is loading in a new window. Defaults to
  • _parent - The url is loaded into the parent frame
  • _self - URL-
  • _top - URL-
  • name -

, JavaScript A, IE , A. :

<a href="javascript:var w=window.open(url, '_blank', 'width=300,height=250');">test</a>

( ):

  <a href="javascript:void(0);" onclick="window.open(url, '_blank', 'width=300,height=250');">test</a>

:

+6

var i = 0;
window.open(url, 'SampleWindow' + i, 'WIDTH=300,HEIGHT=250');
i++;
+2

, . ...

var myWindow = window.open(url, 'SampleWindow'+new Date().getTime(), 'WIDTH=300,HEIGHT=250');

, , .

var myWindow = [];
myWindow.push(window.open(url, 'SampleWindow'+new Date().getTime(), 'WIDTH=300,HEIGHT=250'));

myWindow[index] myWindow[2].close();.

+1

All Articles