?
Solved

Disable parent window while child is open

Posted on 2006-11-02
4
Medium Priority
?
10,268 Views
Last Modified: 2012-06-27
Is there a way to disable the parent window when a child (popup) window is open? Thanks.
0
Comment
Question by:rbichon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 22

Expert Comment

by:WMIF
ID: 17863135
put this in the body tag of the child window.

<body onBlur="self.focus();">
0
 
LVL 2

Accepted Solution

by:
amateur83 earned 1000 total points
ID: 17863620
Use window.ShowModalDialog(url,org,features)

It will disable user to click on parent unless child is terminated.
0
 
LVL 30

Expert Comment

by:third
ID: 17864571
ShowModalDialog is AFAIK, IE only. I suggest using a popup div. Like this code of Michel.


<html>
<head>
<style>
.parentDisable {
z-index:999;
width:100%;
height:100%;
display:none;
position:absolute;
top:0;
left:0;
background-color: #ccc;
color: #aaa;
opacity: .5;
filter: alpha(opacity=50);  
}
#popup {
width:200;
height:100;
position:absolute;
top:200px;
left:200px;
color: #000;
background-color: #fff;
}
</style>
<script>
function pop() {
  document.getElementById('mainDiv').style.display='block';
  return false
}
function hide() {
  document.getElementById('mainDiv').style.display='none';
  return false
}
</script>
</head>
<body">
<input type="text" name="txt1">

<div id="mainDiv" class="parentDisable">
<table border="1" id="popup"><tr><td>   Please <a href="#" onClick="return hide()">click</a></td></tr></table>
</div>

<h1>Hello</h1>
Place a DIV, first thing, on the main page.
z-index:999; width:100%;
height:100%; display:none; position:absolute; top:0; left:0;  
If you feel like getting fancy, you could set the alpha transparency of the
div to like 50 percent or something. Then when you open the other
window, first show this div. You will have issues with select boxes
and other buggy things, ... the easiest way to deal with them is to
set them to display:none while the child window is open.
<br><a href="#" onClick="return pop()">Popup</a>

</body>
</html>
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question