如何打开多个弹出窗口?

时间:2023-01-27 23:11:46

I have five links and each links to a page.

我有五个链接,每个链接到一个页面。

function TohokuImgPopup(url) { 
popupWindow = window.open(
                    url, 'popUpWindow'+randomno, 'height=246,width=228,left=0,top=0,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no')
            }

This is the function I am using. I have different function for the 5 links, each opens a new window. But I am only able to open one popup at a time. How can I open multiple popups?

这是我正在使用的功能。我对5个链接有不同的功能,每个都打开一个新窗口。但我一次只能打开一个弹出窗口。如何打开多个弹出窗口?

2 个解决方案

#1


4  

I found the answer.

我找到了答案。

<script type="text/javascript">

$(document).ready(


function a1(url) { 
popupWindow1 = window.open(
                    url, 'popUpWindow1', 'height=250,width=234,left=0,top=0,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no')
            }

            function a2(url) { 
popupWindow2 = window.open(
                    url, 'popUpWindow2', 'height=250,width=234,left=0,top=0,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no')
            }

            function a3(url) { 
popupWindow3 = window.open(
                    url, 'popUpWindow3', 'height=308,width=299,left=0,top=0,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no')
            }
            }
</script>

<a href="JavaScript:a1('images/focus_img1.html');">focus 1</a>
<a href="JavaScript:a2('images/focus_img2.html');">focus 2</a>
<a href="JavaScript:a3('images/focus_img3.html');">focus 3</a>

These links will be opened in separate windows

这些链接将在单独的窗口中打开

#2


0  

The following code will open the number of popups as you want

以下代码将根据需要打开弹出窗口的数量

<html> 
<head>
<title></title>
<script type="text/javascript">
 function TohokuImgPopup(url) {
window.open(url,"windowName","windowFeatures")
window.open(url,"DifferentWindowName","windowFeatures")// different name for each popup
// create windows as much as you want to create
}
</script>
</head>

<body>
<form>
<input type="button" value="Open Windows" onclick="TohokuImgPopup()">
</form>
</body>

you need to make sure that each window name is different, otherwise the last popup will overwrite it's previous popup. As a result you will end up with a single popup

你需要确保每个窗口名称都不同,否则最后一个弹出窗口将覆盖它之前的弹出窗口。因此,您最终会得到一个弹出窗口

#1


4  

I found the answer.

我找到了答案。

<script type="text/javascript">

$(document).ready(


function a1(url) { 
popupWindow1 = window.open(
                    url, 'popUpWindow1', 'height=250,width=234,left=0,top=0,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no')
            }

            function a2(url) { 
popupWindow2 = window.open(
                    url, 'popUpWindow2', 'height=250,width=234,left=0,top=0,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no')
            }

            function a3(url) { 
popupWindow3 = window.open(
                    url, 'popUpWindow3', 'height=308,width=299,left=0,top=0,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no')
            }
            }
</script>

<a href="JavaScript:a1('images/focus_img1.html');">focus 1</a>
<a href="JavaScript:a2('images/focus_img2.html');">focus 2</a>
<a href="JavaScript:a3('images/focus_img3.html');">focus 3</a>

These links will be opened in separate windows

这些链接将在单独的窗口中打开

#2


0  

The following code will open the number of popups as you want

以下代码将根据需要打开弹出窗口的数量

<html> 
<head>
<title></title>
<script type="text/javascript">
 function TohokuImgPopup(url) {
window.open(url,"windowName","windowFeatures")
window.open(url,"DifferentWindowName","windowFeatures")// different name for each popup
// create windows as much as you want to create
}
</script>
</head>

<body>
<form>
<input type="button" value="Open Windows" onclick="TohokuImgPopup()">
</form>
</body>

you need to make sure that each window name is different, otherwise the last popup will overwrite it's previous popup. As a result you will end up with a single popup

你需要确保每个窗口名称都不同,否则最后一个弹出窗口将覆盖它之前的弹出窗口。因此,您最终会得到一个弹出窗口