Solved

Disable parent window while child is open

Posted on 2006-11-02
4
10,037 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
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 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

896 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now