Categories | Question details Back To List | ||
Problem with onClose event Hellow :) I would like to run a javascript code just before the user close a window. The event is correctly catched but the window is not closed after the js code. Can you tell me please what is the problem with this minimal sample : <html><head> <link rel="stylesheet" type="text/css" href="ext/dhtmlx/css/dhtmlxwindows.css"> <link rel="stylesheet" type="text/css" href="ext/dhtmlx/css/dhtmlxwindows_dhx_blue.css"> <script src="ext/dhtmlx/dhtmlxcommon.js"></script> <script src="ext/dhtmlx/dhtmlxwindows.js"></script> </head><body> <script> var dhxWins = new dhtmlXWindows(); dhxWins.setImagePath("ext/dhtmlx/imgs/"); var w1 = dhxWins.createWindow("w1", 10, 10, 320, 240); w1.setText("dhtmlxWindow"); var str = '<div id="obj">Test Test Test</div>'; w1.attachHTMLString(str); w1.attachEvent('onClose',function(w1){alert('This window will be closed');}); </script> </body> How can I close the the window after the alert message ? Thanks for your answer :) Answer posted by Support on Jan 20, 2009 09:02 You need to have w1.attachEvent('onClose',function(w1){alert('This window will be closed'); return true; }); Returning false or equal value ( returning nothing ) from event handler block operation. Answer posted by dactar on Jan 20, 2009 09:22 It works, thanks a lot :) |