Home : General : Internet Technologies :

General: Internet Technologies: Re: [Andy] Passing value from one Browser Window to another.: Edit Log

Here is the list of edits for this post
Re: [Andy] Passing value from one Browser Window to another.
Thanks for your reply Andy. I should have reported back earlier, but I am still struggling to make it work. The example you gave works.

Here is what I tried based on the example-

First window -

<SCRIPT LANGUAGE="JavaScript">
function openChild(file,window) {
childWindow=open(file,window,'resizable=yes,width=400,height=600,scrollbars=1');
if (childWindow.opener == null) childWindow.opener = self;
}
</SCRIPT>



<FORM NAME="parentForm">
<input type="text" name="School" id="School" maxlength="75" size="20" value=<%if School%>"<%School%>"<%endif%> > &nbsp; &nbsp; <a href=# onClick="openChild('getschool.cgi','win2')">Select School</a>

<br><INPUT TYPE="button" VALUE="Select School" onClick="openChild('getschool.cgi','win2')">
</FORM>


When you click on the link or the button, it works - the child window open.


=============================================================================

The child windows has following code -

print " <SCRIPT LANGUAGE=JavaScript> \n";
print "function updateParent(schl) {\n";
print " alert(schl); \n";
print " opener.document.parentForm.School.value = schl; \n";
print " self.close(); return False; \n";
print " } \n";
print " </SCRIPT> \n";



and the code that print the list of city, schools is -

while (my $ref = $sth->fetchrow_hashref()) {
print "<tr><td width=25%><font face=Arial style=font-size:10pt; > $ref->{'City'} </td><td><i> <a href=# onClick=\"return updateParent($ref->{'Name'});\" > $ref->{'Name'} </a></i>
</font> </td></tr> \n";
}


The child window comes up but sits there for some reason when I click on the links, and does not pass the value or close.

I am trying to make it work. let me know if you see any problems. Or any suggestion to make it work.

Thanks.

Last edited by:

TIF: Apr 6, 2010, 8:25 PM

Edit Log: