View Full Version : DHTML Window can someone help

11-19-2010, 08:37 PM
1) Script Title:

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

3) Describe problem:
<script type="text/javascript">
function openWin()
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.opener.document.write("<p>This is the source window!</p>");

<input type="button" value="Open 'myWindow'" onclick="openWin()" />


HOW to do the same with DHTML window??
thank you

11-20-2010, 08:00 PM
Well you can't. There are no distinct windows. At most, if you use the iframe method, you have a parent and child window, both in the same main window, not an opener and opened window in separate windows as you can with the window.open() method. That's normally an advantage of DHTML window. It cannot be blocked by pop up blockers because it doesn't pop a new window.

When the code in your post executes it wipes out the source window's content. You could get a similar effect with DHTML window. It would be more complicated though. You would have to leave behind whatever code is required to sustain the DHTML window. This would vary depending upon the type of DHTML window that it is, and upon the functionality you would require of its content.

What exactly did you have in mind?

11-21-2010, 06:46 PM
i want in new window to select an node of treeview (or any element of list) and send selected value to text input in parent window

11-21-2010, 09:11 PM
If you want a new window, you will have to work from the code in your original post. But if you want to use DHTML Window, you can access the launching page from the DHTML Window - in most cases with parent.whatever, example:

parent.document.getElementById('someid').innerHTML = 'it works!';

To apply this to your particular DHTML Window, at least as I understand it - what your asking, in the DHTML Window you could have something like:

<select name="somename" onchange="parent.document.getElementById('mytext').value = this.value;">
<option value="thefirst">One</option>
<option value=thesecond"">Two</option>
<option value="thethird">Three</option>

And on the page that launched the DHTML window:

<input type="text" id="mytext" value="thefirst">

If you want more help, please post a link to a page on your site that shows your best attempt at doing this.

11-22-2010, 07:31 AM
i can not send link to the page cos it is in cyrillic but
HTML opens DHTML1 which open DHTML2 which open DHTML3
DHTML3 must return value to DHTML2 and DHTML1
is it possible???

11-22-2010, 10:02 AM
Probably. But for something like that I need to at least know what kind of DHTML Windows these are. Are they:

Inline Text
HTML from an invisible DIV on the page
An external page shown inside an IFRAME
An external page on the same site fetched via Ajax.

Are they all the same kind or not?

One thing I can tell you is that, if using iframe and the pages aren't on the same domain, or even just don't appear to be on the same domain to the browser, then communication between the pages will not work.

11-23-2010, 08:07 AM
kontirane=dhtmlwindow.open("kontirane", "iframe", "http://localhost/kontirane.php", "KONTIRANE", "width=800px,height=600px,left=200px,top=100px,resize=1,scrolling=1")

<input type="text" size="6" name="smetka" id="smetka" ondblclick="openmypage()"/>
top.sm=top.dhtmlwindow.open("sm", "iframe", "http://localhost/smetkoplan.php", "SMETKA", "width=500px,height=500px,left=0px,top=0px,resize=1,scrolling=1")

and from top.sm must return value to kontirane.smetka
is it posible or i need to use other type of DHTML
thank you

11-24-2010, 11:29 AM
I see no:


What's that?

I can tell you that each iframe is named _iframe-id, where id is the id for the DHTML window made using the iframe method. The two you show would be:




So from the page in _iframe-sm, do something like:

top.window.frames['_iframe-kontirane'].document.smetka.something = what

That will need some tweaking. The something = what needs to be filled in. The code itself needs some kind of activation, perhaps from an event on the page in _iframe-sm. Accessing the document or the smetka in that iframe might be a little trickier. It would be much easier if the DHTML windows were made using any of the other methods - other than the iframe method. And I'd like to see the markup for what you're calling "kontirane.smetka".

12-04-2010, 08:50 AM
Thank you
this work perfect