Variable size iframe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KeredDrahcir
    Contributor
    • Nov 2009
    • 426

    Variable size iframe

    I want to be able to create a form that a user can load into an iframe on another site. The only problem is, if the form is long when then Thank You Note is displayed, there will be a lot of empty space.

    Is there a way from the form that is to be loaded into the iframe to control the height of the frame, or is there a way to give the iframe an auto height so it will stretch to fit its content?
    I'd rather not have a scrolling iframe.

    Anither option could be, is there a way to make the iframe disappear after the form inside has been submitted? I can then put the thankyou note in a pop-up window which I'm happy to use.
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    how about using onload action in frame?

    Comment

    • KeredDrahcir
      Contributor
      • Nov 2009
      • 426

      #3
      Sounds good I'll give it a try. It it possilbe to have a functions in an iframe which can hide or show a division in the parent page?

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        that is only possible when the parent page is on the same domain - otherwise it would be considered as cross-site-scripting and the browser will not allow the execution of such operations.

        regards

        Comment

        • KeredDrahcir
          Contributor
          • Nov 2009
          • 426

          #5
          I think that could work. In one case I need to do it on the same domain and you've given me an idea of what to do when it's on a different domain. If I have an iframe what do I need to do to get it to execute a function on a object in the parent page in JavaScript?

          For example, onEvent, hide DIV 1.

          Comment

          • KeredDrahcir
            Contributor
            • Nov 2009
            • 426

            #6
            Any suggestions please?

            Comment

            • gits
              Recognized Expert Moderator Expert
              • May 2007
              • 5390

              #7
              you can refer to the parent with the window's parent property

              Comment

              • KeredDrahcir
                Contributor
                • Nov 2009
                • 426

                #8
                Thank you gits. It works perfectly. This has solved one of my problems. I can try the other one when I have the time to work on it, something I don't have at the present.

                Comment

                Working...