PDA

View Full Version : Sending event from parent window to child window and vice-versa simultaneously


sushilborhade
02-24-2006, 07:13 AM
HI,
I am opening childwin.html page from parentwin.html page on onload event.

On parentwin.html there is one button called "Hello World" and childwin.html there is two buttons called "Hello" and "Enable/Disable".

Clicking on "Enable/Disable" button of childwin.html I want to enable/disable the "Hello World" and "Hello" button of parentwin.html and childwin.html respectily simultaneously.

So how can i achieve this.

Thanks.

glenngv
02-24-2006, 11:34 AM
Code in childwin.html.
function enableDisable(){
if (opener && !opener.closed){ //opener exists and still open
//enable/disable Hello World button in parent window
opener.document.formNameHere.buttonNameHere.disabled = !opener.document.formNameHere.buttonNameHere.disabled;
}
//enable/disable Hello button in current window
document.formNameHere.buttonNameHere.disabled = !document.formNameHere.buttonNameHere.disabled;
}
That will toggle the buttons to enabled and disabled.