Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: How to open a new window when a form submits


Message #1 by anne.do@c... on Wed, 11 Dec 2002 16:57:05 -0500
Anne,

When you open a child window you have access to the parent window's forms and variables.  You access them likie this:

1.  From your main web page:
<form name="getdata" method="post" action="whatever">
<INPUT name = "fld1">&nbsp;&nbsp;<A HREF="#"
onClick="window.open('lookup.asp','windowtitle','toolbar=no,width=450,height=600,left=20,top=5,status=yes,scrollbars=yes,resize=yes,
menubar=no');return false"></a>

2.  in "lookup.asp", provide links to whatever data you've retrieved from a database or whatever like this:
<a href="javascript:Xfer_Street('<%=Data(x)%>')"><%=Data(x)%></font></a>

3.  Example code for the the JS function

<script language="JavaScript">

function Xfer_Data ( Data )
{
   window.opener.document.getdata.fld1.value = Street;
   window.close();
}

</script>



  Return to Index