•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 455,975 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,758 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 4090 | Replies: 3
![]() |
•
•
Join Date: Nov 2007
Posts: 19
Reputation:
Rep Power: 1
Solved Threads: 0
how to disable the parent window when we open the child window. i have written this code but its working only one time.any one can help me
s.html
<html>
<head>
<SCRIPT >
function popuponclick()
{
my_window = window.open("p.html",
"mySelect", "status=1,width=750,height=450,resizable=no");
}
</script>
</head>
<body>
<form name="formSelect">
<P>
<A HREF="#" onclick='popuponclick()' >show popup window</A><br>
</P>
</div>
</form>
</body>
</html>
p.html
<html>
<head>
<script language = javascript>
</script>
</head>
<body onBlur="self.focus()">
bbb
</body>
</html>
s.html
<html>
<head>
<SCRIPT >
function popuponclick()
{
my_window = window.open("p.html",
"mySelect", "status=1,width=750,height=450,resizable=no");
}
</script>
</head>
<body>
<form name="formSelect">
<P>
<A HREF="#" onclick='popuponclick()' >show popup window</A><br>
</P>
</div>
</form>
</body>
</html>
p.html
<html>
<head>
<script language = javascript>
</script>
</head>
<body onBlur="self.focus()">
bbb
</body>
</html>
•
•
Join Date: Dec 2007
Posts: 75
Reputation:
Rep Power: 1
Solved Threads: 10
Try these instead:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hielo's Parent Page</title>
</head>
<body>
<script type="text/javascript">
var child_window=null;
var parent_window=window;
function popUponClick()
{
child_window = window.open("p.html", "mySelect", "status=1,width=750,height=450,resizable=no");
parent_window.onclick = blurify;
parent_window.onfocus = blurify;
return false;
}
function blurify()
{
if(child_window)
{
if(parent_window)
parent_window.blur();
child_window.focus();
}
}
</script>
<form name="formSelect">
<p><a href="#" onclick='return popUponClick();'>show popup window</a><br /></p>
</div>
</form>
</body>
</html>
========================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hielo's Child Page</title>
<script type="text/javascript"><!--
var parent_window = window.opener;
var child_window = window.self;
function closeIt()
{
if(parent_window)
{
if(window.ActiveXObject)
{
child_window.blur();
parent_window.focus();
}
parent_window.close();
child_window.focus();
parent_window=null;
}
}
//--></script>
</head>
<body>
<form action="." method="POST">
<input type="button" value="Close Parent" onclick="closeIt();"/><input type="button" value="Close Me" onclick="self.close();"/>
</form>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hielo's Parent Page</title>
</head>
<body>
<script type="text/javascript">
var child_window=null;
var parent_window=window;
function popUponClick()
{
child_window = window.open("p.html", "mySelect", "status=1,width=750,height=450,resizable=no");
parent_window.onclick = blurify;
parent_window.onfocus = blurify;
return false;
}
function blurify()
{
if(child_window)
{
if(parent_window)
parent_window.blur();
child_window.focus();
}
}
</script>
<form name="formSelect">
<p><a href="#" onclick='return popUponClick();'>show popup window</a><br /></p>
</div>
</form>
</body>
</html>
========================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hielo's Child Page</title>
<script type="text/javascript"><!--
var parent_window = window.opener;
var child_window = window.self;
function closeIt()
{
if(parent_window)
{
if(window.ActiveXObject)
{
child_window.blur();
parent_window.focus();
}
parent_window.close();
child_window.focus();
parent_window=null;
}
}
//--></script>
</head>
<body>
<form action="." method="POST">
<input type="button" value="Close Parent" onclick="closeIt();"/><input type="button" value="Close Me" onclick="self.close();"/>
</form>
</body>
</html>
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- disable parent window (JavaScript / DHTML / AJAX)
- ratpoison... (Window and Desktop Managers)
- Open In New Window Php (PHP)
- open links in parent window (from child)? (JavaScript / DHTML / AJAX)
- blank pop-ups (Viruses, Spyware and other Nasties)
- JavaScript/DHTML newbie -- general questions (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Javascript problems onClick and calcuations
- Next Thread: javascript pop-up div



Linear Mode