View Full Version : DHTML Window widget to pass back value

10-11-2007, 08:46 PM
1) Script Title: (v1.03)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem: I open testme.asp in DHTML Window widget from testbatch.asp I want testme.asp to enter selected value in textbox of parent page testbatch.asp:confused:

It would be really nice if widget would close and put the value in the textbox when submit is pressed in form control

10-11-2007, 10:21 PM
Tried to use some javascript in widget:
<script language="JavaScript">
function sendBack(value) {
this.opener.document.main.EMP1.value = value;

<a href="javascript:sendBack('One')">One</a>

The parent has form name="main" and target input type="text" name="EMP1"

but it's not working

10-11-2007, 11:56 PM
You wouldn't use "this.opener", but "parent" instead, inside your script. For example:

<form id="testform">
<input type="text" id="mybox" />

var googlewin=dhtmlwindow.open("googlebox", "iframe", "test.htm", "#1: Test", "width=590px,height=350px,resize=1,scrolling=1,center=1", "recal")

Here's the source for "test.htm":

<script type="text/javascript">

function postback(thevalue){


<input type="text" id="test" /> <input type="button" value="Save" onClick="postback(document.getElementById('test').value)" />

10-17-2007, 12:33 PM
That was it! Now works like a charm. Thanks so much. :)
OK now looking around to see how to close the DHTML widget window.close is not supported:confused:

10-17-2007, 01:00 PM
This works:
<input type="button" value="CLOSE" name="exit" onClick="javascript:parent.closeit()">