How do call a function from inside an iframe?

Discussion in 'Javascript' started by Paul, Sep 21, 2005.

  1. Paul

    Paul Guest

    HI! I need to call a function that is located in the parent. I need it so
    that it calls when the child page in the iframe loads.

    Would it be better to use an onload event in the body? if so how do I call
    it from the child page?

    --
    Thanks in advance :)

    Paul
    Paul, Sep 21, 2005
    #1
    1. Advertising

  2. Paul

    Jon Spivey Guest

    Hi,
    Onload fires when the whole page (including iframes) has loaded. You'd put
    the function call in the body of the parent page, eg
    <body onload="someFunction();">

    --
    Cheers,
    Jon
    Microsoft MVP

    "Paul" <> wrote in message
    news:de2Ye.7721$...
    > HI! I need to call a function that is located in the parent. I need it so
    > that it calls when the child page in the iframe loads.
    >
    > Would it be better to use an onload event in the body? if so how do I call
    > it from the child page?
    >
    > --
    > Thanks in advance :)
    >
    > Paul
    >
    Jon Spivey, Sep 21, 2005
    #2
    1. Advertising

  3. Paul

    ASM Guest

    Paul wrote:
    > HI! I need to call a function that is located in the parent. I need it so
    > that it calls when the child page in the iframe loads.
    >
    > Would it be better to use an onload event in the body? if so how do I call
    > it from the child page?


    in the child page :

    <body onload="parent.myFunction()">



    --
    Stephane Moriaux et son [moins] vieux Mac
    ASM, Sep 21, 2005
    #3
  4. Paul

    Paul Guest

    HI! Thanks, I will try it. :)

    Paul

    "Jon Spivey" <> wrote in message
    news:...
    > Hi,
    > Onload fires when the whole page (including iframes) has loaded. You'd put
    > the function call in the body of the parent page, eg
    > <body onload="someFunction();">
    >
    > --
    > Cheers,
    > Jon
    > Microsoft MVP
    >
    > "Paul" <> wrote in message
    > news:de2Ye.7721$...
    >> HI! I need to call a function that is located in the parent. I need it so
    >> that it calls when the child page in the iframe loads.
    >>
    >> Would it be better to use an onload event in the body? if so how do I
    >> call it from the child page?
    >>
    >> --
    >> Thanks in advance :)
    >>
    >> Paul
    >>

    >
    >
    Paul, Sep 21, 2005
    #4
  5. Paul

    Paul Guest

    One other question though?

    HI! I want to simulate resizing the parent page page by using this function.

    <script language="JavaScript">
    function firefoxautofix(x,y,){
    parent.window.resizeBy(-1,-1)
    parent.window.resizeBy(+1,+1)
    }
    </script>

    Should this function be in the head or the body?

    I want to get around a small bug in firefox that does not seem to resize (
    after a iframe resize script is executed) the body unless the user refreshes
    the page or resizes the browser manually from left to right. So I figure
    that I would try to simulate a manual resize with this script.

    Would I just call it like so.

    <body onload="firefoxautofix();">

    --
    Thanks in advance :)

    Paul
    "Paul" <> wrote in message
    news:de2Ye.7721$...
    > HI! I need to call a function that is located in the parent. I need it so
    > that it calls when the child page in the iframe loads.
    >
    > Would it be better to use an onload event in the body? if so how do I call
    > it from the child page?
    >
    > --
    > Thanks in advance :)
    >
    > Paul
    >
    Paul, Sep 21, 2005
    #5
  6. Paul

    Paul Guest

    HI! thanks asm I think I might use this method.


    Thanks

    Paul
    "ASM" <> wrote in message
    news:4330bbf5$0$5394$...
    > Paul wrote:
    >> HI! I need to call a function that is located in the parent. I need it so
    >> that it calls when the child page in the iframe loads.
    >>
    >> Would it be better to use an onload event in the body? if so how do I
    >> call it from the child page?

    >
    > in the child page :
    >
    > <body onload="parent.myFunction()">
    >
    >
    >
    > --
    > Stephane Moriaux et son [moins] vieux Mac
    Paul, Sep 21, 2005
    #6
  7. Paul

    ASM Guest

    Re: One other question though?

    Paul wrote:
    > HI! I want to simulate resizing the parent page page by using this function.
    >
    > <script language="JavaScript">
    > function firefoxautofix(x,y,){
    > parent.window.resizeBy(-1,-1)
    > parent.window.resizeBy(+1,+1)
    > }
    > </script>
    >
    > Should this function be in the head or the body?
    >
    > I want to get around a small bug in firefox


    is it really a bug ?
    thought on validate conventions an iFrame can't be resized ?

    > that does not seem to resize (
    > after a iframe resize script is executed) the body unless the user refreshes
    > the page or resizes the browser manually from left to right. So I figure
    > that I would try to simulate a manual resize with this script.
    >
    > Would I just call it like so.
    >
    > <body onload="firefoxautofix();">


    you're joking ?



    --
    Stephane Moriaux et son [moins] vieux Mac
    ASM, Sep 21, 2005
    #7
  8. Paul

    Ronx Guest

    Re: One other question though?

    Note that firefox has an option setting to disable scripts that resize
    the browser - I believe this is the default setting.
    In FireFox: Tools->Options->Web Features - Advanced button
    --
    Ron Symonds
    Microsoft MVP (FrontPage)
    Reply only to group - emails will be deleted unread.


    "Paul" <> wrote in message
    news:%...
    > HI! I want to simulate resizing the parent page page by using this
    > function.
    >
    > <script language="JavaScript">
    > function firefoxautofix(x,y,){
    > parent.window.resizeBy(-1,-1)
    > parent.window.resizeBy(+1,+1)
    > }
    > </script>
    >
    > Should this function be in the head or the body?
    >
    > I want to get around a small bug in firefox that does not seem to
    > resize ( after a iframe resize script is executed) the body unless
    > the user refreshes the page or resizes the browser manually from
    > left to right. So I figure that I would try to simulate a manual
    > resize with this script.
    >
    > Would I just call it like so.
    >
    > <body onload="firefoxautofix();">
    >
    > --
    > Thanks in advance :)
    >
    > Paul
    > "Paul" <> wrote in message
    > news:de2Ye.7721$...
    >> HI! I need to call a function that is located in the parent. I need
    >> it so that it calls when the child page in the iframe loads.
    >>
    >> Would it be better to use an onload event in the body? if so how do
    >> I call it from the child page?
    >>
    >> --
    >> Thanks in advance :)
    >>
    >> Paul
    >>

    >
    >
    Ronx, Sep 21, 2005
    #8
  9. Paul

    Paul Guest

    Re: One other question though?

    Thanks for pointing that out. I have already get that though. that's anyways
    :)

    Paul


    "Ronx" <> wrote in message
    news:%23df8b%...
    > Note that firefox has an option setting to disable scripts that resize the
    > browser - I believe this is the default setting.
    > In FireFox: Tools->Options->Web Features - Advanced button
    > --
    > Ron Symonds
    > Microsoft MVP (FrontPage)
    > Reply only to group - emails will be deleted unread.
    >
    >
    > "Paul" <> wrote in message
    > news:%...
    >> HI! I want to simulate resizing the parent page page by using this
    >> function.
    >>
    >> <script language="JavaScript">
    >> function firefoxautofix(x,y,){
    >> parent.window.resizeBy(-1,-1)
    >> parent.window.resizeBy(+1,+1)
    >> }
    >> </script>
    >>
    >> Should this function be in the head or the body?
    >>
    >> I want to get around a small bug in firefox that does not seem to resize
    >> ( after a iframe resize script is executed) the body unless the user
    >> refreshes the page or resizes the browser manually from left to right. So
    >> I figure that I would try to simulate a manual resize with this script.
    >>
    >> Would I just call it like so.
    >>
    >> <body onload="firefoxautofix();">
    >>
    >> --
    >> Thanks in advance :)
    >>
    >> Paul
    >> "Paul" <> wrote in message
    >> news:de2Ye.7721$...
    >>> HI! I need to call a function that is located in the parent. I need it
    >>> so that it calls when the child page in the iframe loads.
    >>>
    >>> Would it be better to use an onload event in the body? if so how do I
    >>> call it from the child page?
    >>>
    >>> --
    >>> Thanks in advance :)
    >>>
    >>> Paul
    >>>

    >>
    >>

    >
    >
    Paul, Sep 21, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Ianson
    Replies:
    22
    Views:
    175,460
    anne nowess
    Aug 14, 2012
  2. Daedalous
    Replies:
    3
    Views:
    653
    Daedalous
    Jan 16, 2004
  3. Nathan Carr
    Replies:
    0
    Views:
    255
    Nathan Carr
    Sep 17, 2004
  4. Chris Ianson
    Replies:
    18
    Views:
    284
    Marcello
    Apr 6, 2006
  5. omprakash
    Replies:
    0
    Views:
    266
    omprakash
    Jul 30, 2012
Loading...

Share This Page