IT Certificaions

Google Cloud Platform

Monday, November 28, 2011

Accessing parent window form from child window in html


Accessing parent window form from child window in html

window.parent.document.parentFormName.submit();

Here parentFormName is the name of Form of parent window that you want to submit from child window.
Ex, <form name="parentFormName".....>


Accessing parent window's form input parameters to child window,

var userName= window.parent.document.getElementById('userName').value;

Here userName is the id element of input field on parent form.
Ex.
    <form name="parentFormName".....>
<input type="text" id="userName" />
</form>
---------------------------------------------------------------------------------------------------------------