使用window.open()的多个Windows

时间:2013-09-11 04:36:37

标签: javascript asp.net

因此,众所周知,如果您单击其中嵌入了onClick(windown.open(...))的提交按钮,则会打开一个新窗口,其中包含您指定的所有可爱属性。但是,如果然后继续单击父窗口并再次单击“提交”按钮而不关闭上一个弹出窗口,则会用新数据覆盖该窗口。

现在我需要一种方法让window.open()脚本在每次点击时创建新窗口。理论上我可以连续2次点击父“提交”按钮,并出现2个不同的子窗口。

我确信这是微不足道的,但我似乎找不到任何东西。

5 个答案:

答案 0 :(得分:17)

为每个窗口new window name

window.open(url, WindowName)

答案 1 :(得分:10)

试试这个,它会创建新的孩子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');

答案 2 :(得分:2)

选中此项可能会帮助您每次都打开新窗口。

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery demo</title>
  <script src="jquery-1.9.1.js"></script>
</head>
<body>

<script>
$(document).on("click", "#btn", function(event) {
    window.open("http://www.google.com", '_blank');
});

</script>
<input type=button name="btn" id="btn">
</body>
</html>

答案 3 :(得分:1)

window.open(url, '', 'width=1000, height=500')

然后,每次单击popupbutton都会得到一个新的弹出窗口。

答案 4 :(得分:-1)

您需要禁用仅打开一个窗口的Track出站链接。将以下javascript代码添加到index.html文件:

<script type="text/javascript">
  var clicky_custom = clicky_custom || {};
  clicky_custom.outbound_disable = 1;
</script>
相关问题