?
Solved

Disable parent window while child is open

Posted on 2006-11-02
4
Medium Priority
?
10,220 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
Suggested Courses

771 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