How to access dhxWins from iframe content

Hi Folks,

I have a dhxWindow that gets it’s content by a call to attachObject(iframObj).
Now I would like to be able to close this window when a button is clicked but I am not able to get a handle to the window from within the iframe. I have tried using parent.dhxWins.window(id).close() from within the iframe, but so far am unable to get at it. Any help would be greatly appreciated.

Thanks,

Daryl

Hi
You need to use attachURL method to load iframe in the window.
Try to use
window.parent.dhxWins.window(id).close()
Something like below:
index.html

[code]

Close Error html,body { height: 100%; margin: 0px; overflow: hidden; }
[/code] [b]button_close.html[/b] [code]!!! [/code]

Thanks Darya, I appreciate the help, but I am still getting an error:

Uncaught TypeError: Cannot call method ‘window’ of undefined

The code I am using follows:

Javasccript:

dhxWins = new dhtmlXWindows();
win = dhxWins.createWindow(“help-window”, position_x, position_y, width, height);
win.attachURL(url);

url HTML:

Close

I’m thinking maybe ‘’ just do a straight ajax call to get the content and then use win.attachHTMLString(content), I think it will be more straight forward.

Thanks again for your help.

Regards,

Daryl

Could you please provide us completed demo to reprodue your issue? Locally it seems like everyting is ok.
docs.dhtmlx.com/doku.php?id=othe … leted_demo