Can a jsp file in an IFrame calls a javascript function outside of the IFrame

Discussion in 'JavaScript' started by jadeite100, May 31, 2007.

  1. #1
    Hi:

    I am using IE 6 SP2.
    My resize attribute does not work <body onresize="test1();">.
    When I resize my window, the resize event doesnot get call.

    I have a jsp page with an iFrame called test1.jsp. The iFrame src points to a page called test2.jsp. It has a resize
    attribute that calls a javascript function that is located in test1.jsp.
    In the test2.jsp page, it doesn't recognize the function that is located in test1.jsp page. Is there anyway to do this.

    test1.jsp:
    If the above is not possible, is there another way to capture the event when a popup window is resize or maximize or mimize.
    I tried <body onresize="test1();"> it doesn't work. I event tried:
    window.onresize=test1 and it doesn't work.

    I tried <body onmove="test1();"> It partially works. When I miminize the popup window it triggers the event but when I maximize the popup
    window from a smaller popup window it doesn't trigger an event.

    Any hint or help or direction to an url would be greatly appreciated.

    Yours,

    Frustrated.
     
    jadeite100, May 31, 2007 IP
  2. DavidMerrilees

    DavidMerrilees Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can add an event handler to capture a resize event like this:

    
    window.onresize = function() {
    
    }
    
    HTML:
    However, it will not fire when the window is minimised or maximised, only when the window is resized by the user.

    To call a script in one frame from another you need to correctly reference the frame in which the script resides. To reference a script in the parent window of the iframe use:

    
        window.parent.myfunction();
    
    HTML:
    or to call a script in the iframe from your parent window use:

    
        window.frames[0].myFunction();
    
    HTML:
     
    DavidMerrilees, May 31, 2007 IP