Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening a new pop up window from another pop up window using javascript

I want to open a pop up from another pop up and i used below code, but when i click the pop up refresh and the items appear in it instead of another pop up.

I want to show two popup, but only one pop's up. Can anybody helps me?

The code:

function pop_up(url) {
    newwindow = window.open(url,
        'name',
        'height=517,width=885,scrollbars=yes,toolbar=no,menubar=no,resizable=yes,location=no,directories=no,status=no,titlebar=no,left=400,top=120');
    if (window.focus) { newwindow.focus() }
    return false;
}

Click event code:

Page.ClientScript.RegisterStartupScript(GetType(), "popup",
    "pop_up_Info('" + "PopUpEmailing.aspx" + "');", true);
like image 638
Reza Avatar asked Nov 20 '25 19:11

Reza


2 Answers

Similar question was answered here.

You have to specify a new name for the window in the window.open method.

like image 171
Marcus Vinicius Avatar answered Nov 23 '25 08:11

Marcus Vinicius


Modify your control pop_up function:

function pop_up(url, windowName) {
    newwindow = window.open(url, 
        windowName,
        'height=517,width=885,scrollbars=yes,toolbar=no,menubar=no,resizable=yes,location=no,directories=no,status=no,titlebar=no,left=400,top=120');
    if (window.focus) { newwindow.focus() }
    return false;
}

Then in your call registered call do:

 Page.ClientScript.RegisterStartupScript(GetType(),
     "popup", "pop_up('PopUpEmailing.aspx', 'PopUpEmailing');", true);

Make sure the second param is different name from the window that called the original popup.

like image 38
Kelsey Avatar answered Nov 23 '25 07:11

Kelsey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!