Gravity M Gravity M -4 years ago 61
Javascript Question

How to open multiple pop-up windows?

I have five links and each links to a page.

function TohokuImgPopup(url) {
popupWindow =
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?

Answer Source

I found the answer.

<script type="text/javascript">


function a1(url) { 
popupWindow1 =
                    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 =
                    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 =
                    url, 'popUpWindow3', 'height=308,width=299,left=0,top=0,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no')

<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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download