Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Luis Eugênio on Dec 14, 2008 11:48
open dhtmlx forum
dhtmlxWindow

I have two windows opened, win1 is normal and win2 is modal.
How can I execute an javascript function ( i.e. myUpdate() ) in win1 after a close win2.
Is it possible ?

I´m trying this but it does´t works.

<script>
var onFocus = function(winId)
{
if (_isIE) {
winId._frame.contentWindow.document.myUpdate();
} else {
    alert( winId._frame.contentDocument.myUpdate();
}

// global
dhxWins.attachEvent('onFocus', onFocus);
</script>
Answer posted by Support on Dec 15, 2008 01:35
    page_1.html >>
    ...
    <script>
        function myFunc() {
             ...
        }
    </script>

    page index.html >>
    ...
    var dhxWins= new dhtmlXWindows(...);
    ...
    dhxWins.window("w1").attachURL("page_1.html"); // for running function
    dhxWins.window("w2")... // for closing
   
    dhxWins.attachEvent("onClose", functon(win){
         // check window id
         if (win.getId() == "w2") {
             // calling function
             dhxWins.window("w1")._frame.contentWindow.myFunc();      
             // closing window
             return true;
          }
    });