There may be times to access the parent window’s control in the child window. Here is the sample code which does this -
Assume that you have a control named 'txt1' of text type in the Parent.html, and you open a new window on a button click as,
window.open("Child.html","Child","height=400px,width=500px,resizable=yes,scrollbar=no,status=no");
and you can access the control 'txt1' in the Child.html as,
var parentWinCtrl = window.opener.document.getElementById('txt1');
and you can assign or retrieve the value from the parentWinCtrl variable,
to assign - parentWinCtrl.value = "something";
to access - var parentVal = parentWinCtrl.value;
Monday, August 11, 2008
Labels:
Java Script,
JavaScript,
JS
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment