Hello, I need some help here with javascript and form.
My question is I need to parse back some data from a pop up page to the calling page form field. Anyway I can do this?
Here is the sample code of what I am doing.
This is the calling page which will pop up a new window:
<SCRIPT language=Javascript>
<!--
function PopUp() {
W = window.open('data.php', "WinA", "location=no,scrollbars=yes");
}
//-->
</SCRIPT>
<form name='IPP' method='post' action='<? echo($PHP_SELF) ?>'>
<input class='Gen' type='text' name='name' size='30'>
<a href='javascript:PopUp()' class='get'>Get Data</a>
</form>
And the data.php will list all data with link eg. aaa, bbb, ccc.
So, what javasript code should I add to data.php when I click on aaa, it will pass back aaa to the calling page form IPP.name.value?
you can use the "opener" property to reference form fields, variables and functions in the window that opened the popup. In your popup try this:
opener.document.IPP.name.value="some text"
opener refers to the window that opened the poupup.
Bookmarks