Originally posted by Mary Cole:
Hey himanshu,
Thx for ur reply.
Actually U guys didn't get my point.
2 scenarios are there
1)When the pop up is open and when i click on the pop up windows's close icon(browsers)
, the pop up window closes and automatically the parent windows button should be enabled
2)When the pop up is open, and when i click anywhere on the parent window , the popup should automatically close and enable the parent windows button
I need a script which satisfies these scenarios too
icon
I think you haven't looked carefully at sample code.I am sure it does satisfies your first criteria.
Anyway, try this code and see does it satisfies your all criterias.
-----------------
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
var child;
var flag=1;
function checkFocus(){
if(flag==1){
if (child && !child.closed){
child.close();
parentFrm.BBttn.disabled=false;
}
}else{
flag=1;
}
}
document.onclick = checkFocus;
if (document.captureEvents){
document.captureEvents(Event.CLICK);
}
function openChildWindow() {
child = window.open('popup.htm','myWindow','toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes,width=640,height=480');
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="parentFrm" >
<INPUT TYPE =button name="ABttn" value="A" onclick="javascript

penChildWindow()"> <br><br>
<INPUT TYPE = button name="BBttn" value="B" DISABLED>
</FORM>
</BODY>
</HTML>
---------------------
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
opener.flag=0;
</SCRIPT>
</HEAD>
<BODY onUnload="opener.parentFrm.BBttn.disabled=false;">
<FORM name=childFrm >
<INPUT TYPE = button name="clsBttn" value="Close" onclick="window.close()">
</FORM>
</BODY>
</HTML>
-----------------