Javascript passing variables between windows

Associate
Joined
30 Dec 2005
Posts
415
OK I want to pass two variables from a window to the one which originally opened it.

The code that opens the window:
Code:
window.open('/estimate.php','scrollbars=yes,menubar=no,height=480,width=515,resizable=yes,toolbar=no,location=no,status=no');
Also on that parent page:
Code:
nextgridreferenceheightgained=document.newday.nextgridreferenceheightgained.value;
distancetonext=document.newday.distancetonext.value;
And on estimate.php:
Code:
opener.nextgridreferenceheightgained="3";
opener.distancetonext="0";

Btw don't know why the forum is adding random spaces in :confused:


Can anyone help make this code work?
 
Don't you need something like:

window.open('/estimate.php?variable='blah','scrollbars=yes,menubar=no,height=48 0,width=515,resizable=yes,toolba....

Is there such a thing as querystring in php?
 
I want the variables to come from estimate.php to the one that opened it....
Other way round ;) else that would have been easy to do with PHP.
I'm just generally pants with JavaScript!
 
Thanks :)

In the end I had to use:
Code:
<script language="JavaScript" type="text/javascript">
<!--
window.opener.document.newday.nextgridreferenceheightgained.value="<?php echo $heightgained; ?>";
window.opener.document.newday.distancetonext.value="<?php echo $totalkm; ?>";
-->

I knew I was kind of close.

Again, thanks!
 
Back
Top Bottom