I need to add a link “click to close” in the dhtmlx window. On clicking the link, the window should close.
Could you pls send me the script to close a dhtmlx window.
Thanks in advance!
Madhuri
You can use close() method to close dhtmlxwindow:
var win = dhxWins.createWindow(…);
…
win.close();
Hi Alex,
Thanks for your reply.
I have tried the close method. But it throws a js error “dhxWins is undefined"
Here is the script i use to open the window.
var w1;
var dhxWins;
function attachURL(url, title, width, height)
{
dhxWins = new dhtmlXWindows();
dhxWins.setImagePath(”…/…/Includes/dhtmlxWindows/codebase/imgs/");
dhxWins.setSkin(“modern_blue”);
w1 = dhxWins.createWindow(“w1”, 300, document.documentElement.scrollTop+100, width, height);
w1.setText(title);
w1.attachURL(url);
w1.button(“close”).show();
}
The main page calls the above js function to open a dhtmlx window. I want to add a link “click to close” in the dhtmlx window.
On clicking the link the window should close.
i have tried using “w1.close();” and “dhxWins.close();”.
Both throw the js error. i think that is because the variables are defined in the main page.
Could you please suggest a solution.
Thanks in advance!
Madhuri
Hello Madhuri,
the attachURL method loads a page into an iframe. So, if the close() method is called from the iframe, you can use the following method:
parent.w1.close();
Please, take a look at the sample in the window package dhtmlxWindows/samples/init/inner_close.html