Categories | Question details Back To List | ||
Script to close a dhtmlx window 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 Answer posted by Alex (support) on Jun 12, 2009 01:26 You can use close() method to close dhtmlxwindow: var win = dhxWins.createWindow(.....); ... win.close(); Answer posted by Madhuri on Jun 14, 2009 12:21 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 Answer posted by Alex (support) on Jun 14, 2009 23:48 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 |