我有五个链接,每个链接指向一个页面。
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')
}
这是我正在使用的功能。我对 5 个链接有不同的功能,每个链接都会打开一个新窗口。但是我一次只能打开一个弹出窗口。如何打开多个弹出窗口?
最佳答案
我找到了答案。
<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>
这些链接将在单独的窗口中打开
关于javascript - 如何打开多个弹窗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18816343/