Accessing functions between windows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Leo Smith
    New Member
    • Mar 2007
    • 45

    #1

    Accessing functions between windows

    I would like to know how to access a function in a window from a created window. Here is a sample.

    Original Window:
    function OpenJobPage(var id)
    {
    var newWin = window.open('su bwin.aspx?id=' + varid, 'popNewWindow' + jobid, 'toolbar=0, ' + 'height=500, width=850, resizable=1, scrollbars=1');

    if(newWin.opene r == null)
    newWin.opener = window;
    newWin.focus();
    return false;
    }

    function RefreshContents ()
    {
    // ... function
    }

    // Function in created window
    function RefreshParent()
    {
    try
    {
    if(window.opene r != null)
    {
    alert("Attempti ng Refresh");
    parent.window.o pener.RefreshLi st();
    }
    }
    catch(ex)
    {
    alert("Function Missing:\n\n" + ex);
    }

    }

    I get the refresh alert, it just doesn't run the script from the first window.

    Thanks,
    Leo
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    i believe you need to take parent. off
    window.opener should call it.

    Comment

    • Leo Smith
      New Member
      • Mar 2007
      • 45

      #3
      I tried it both ways and it still doesn't open an alert for the dialog.

      Thanks,
      Leo

      Comment

      • Leo Smith
        New Member
        • Mar 2007
        • 45

        #4
        I narrowed down the problem. Function is calling, but I am trying to do an AJAX call from the page, and I don't think I can do that from another page. The function needs to call the server to update a table in the originating page. I'll see what I can come up with.

        Leo

        Comment

        Working...