Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    RIK
    RIK is offline
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    calling function from iframe

    Hiya,

    This should be straight-forward, but for some reason I have a severe case of the dumbs today and can't get it working:

    I have an application component that uses an iframe to display online help topics. The content is generated by XML and XSL, then written to the body.innerHTML of the iframe document. To close the topic, users click a close button (also generated on the fly). The close button should set the display of the iframe to 'none'.

    I can do that no problem from a link outside the iframe, but I can't figure out the right way to code button inside the iframe. The function being called is included in an external js file linked to the parent document of the iframe, but I can't get the syntax right to call the function from inside the iframe...

    Oh - only has to work in IE 5.5+ (intranet so one supported browser.)

    Thanks for any help.

    Cheers,
    RK

  • #2
    Regular Coder
    Join Date
    Dec 2002
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RIK
    Hiya,

    This should be straight-forward, but for some reason I have a severe case of the dumbs today and can't get it working:

    I have an application component that uses an iframe to display online help topics. The content is generated by XML and XSL, then written to the body.innerHTML of the iframe document. To close the topic, users click a close button (also generated on the fly). The close button should set the display of the iframe to 'none'.

    I can do that no problem from a link outside the iframe, but I can't figure out the right way to code button inside the iframe. The function being called is included in an external js file linked to the parent document of the iframe, but I can't get the syntax right to call the function from inside the iframe...

    Oh - only has to work in IE 5.5+ (intranet so one supported browser.)

    Thanks for any help.

    Cheers,
    RK
    In your button's onclick property, perhaps try...

    Code:
    this.ownerDocument.parentWindow.close()

  • #3
    RIK
    RIK is offline
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hiya,

    As soon as I posted, the light came on, and I figured it out (very close to the suggested answer - thanks for that...)

    Cheers,
    RK


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •