PDA

View Full Version : "Connecting" two pages



d-machine
09-20-2008, 05:45 AM
Hi

I have 2 pages: index.html, popup.html

The page popup.html includes one button. The page index.html includes a text bbox.

I want that by clicking on this button, it will print some text in a text box which I have in index.html.

I thought about using window.opener or something like this, but I'm not sure yet.

Any suggestions? :confused:

rangana
09-20-2008, 06:05 AM
index.html:


<input type="text" id="mytext" readonly="readonly"><input type="button" value="Open Popup.html" onclick="window.open('popup.html','mywin','height=150,width=300');">


popup.html:


<input type="button" value="Print some text on index's textbox" onclick="window.opener.document.getElementById('mytext').value='Perfect!';window.close();">


Hope that helps.

schorhr
09-20-2008, 06:10 AM
//EDIT Oops, too slow :-)

Open a popup...

<script language="JavaScript"><!--
myWindow = window.open('test.htm','Example','width=200,height=200');
//--></script>


adressing it...

<script language="JavaScript"><!--
myWindow.document.getElementById('myinput').value="Foo";
//--></script>

some random textfield with the id...

<input id="myinput" />

d-machine
09-20-2008, 07:00 AM
Thank you both very very much !!!!!!!