View Full Version : How to disable the parent window when a new popup window is opened from it

08-05-2002, 07:57 AM
I have a MAIN.JSP page and there is a HREF (hyper reference) on it. When a user clicks the HREF a popup window POP.JSP is opened. I used the following syntax to achieve this (this code is written in JAVA script in MAIN.JSP):
function popup_click() {
var page = "POP.JSP";
windowprops = "height=150,width=300,location=no,"
+ "scrollbars=no,menubars=no,toolbars=no,resizable=no";
window.open(page, "Popup", windowprops);

The problem is that when the pop up window is displayed I want to disable the MAIN.JSP window. Question is : How to achieve this functionality?

Waiting for a reply from experts.


08-05-2002, 07:59 AM
What do you mean by "disable" it? Close it?

08-05-2002, 08:04 AM
No, I do not want the window to be closed. By disabling I mean that the user cannot do anything on the MAIN.JSP until he closes the POP.JSP (like if you open a alert() box through JAVA script than until you don't close it you cannot do anything to the parent window ).

Mr J
08-05-2002, 11:34 PM
Try this

In the page loaded into the popup window add


to the opening BODY tag

You cannot access any windows until the popup is closed

08-06-2002, 08:29 AM
Thank you very much for your advice Mr. J. The syntax works!
But there is a slight problem in this solution that is this syntax does not allow you to select a value from the combo boxe(s) that are on the POP.JSP.

08-06-2002, 04:21 PM
You can use a modeless window for IE5+ users: