iFrame will not open second time around

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jaiwebs
    New Member
    • Nov 2006
    • 5

    iFrame will not open second time around

    Hello,

    I am having a problem with an iFrame.

    I have it so the iframe is not visible when the page ids loaded.
    I have a link (null) that when clicked opens the iframe.

    On the iframe I have a link to some javascript that closes the iFrame.

    All is fine, but if I click on the original link to open the iFrame a second time
    nothing happens.

    Any ideas anyone ?

    Thanks
  • jaiwebs
    New Member
    • Nov 2006
    • 5

    #2
    I should also add that when the linkis clicked it opens a new layer and in that layer the iframe is opened.

    The iframe shows ok and the link inside close the iframe but the link will not open the layer again.

    Thanks

    Comment

    • pronerd
      Recognized Expert Contributor
      • Nov 2006
      • 392

      #3
      Originally posted by jaiwebs
      I should also add that when the linkis clicked it opens a new layer and in that layer the iframe is opened.

      The iframe shows ok and the link inside close the iframe but the link will not open the layer again.

      Thanks
      How is the iFrame closed? Posts are more likely to get responses when lots of specific information, and example code is provided. I am guessing what evering is being done to close the iFrame is either destroying the layer needed for it to open in, or removing what ever identifyed the iFrame.

      Or it is possible that on close it is being set to invisible, or display is being set to "none" and it is not undone when reopening the iFrame. So the iFrame is acually reopening but can not be seen.

      Comment

      • jaiwebs
        New Member
        • Nov 2006
        • 5

        #4
        Thanks for the reply.
        I have been trying to set it all out with the close iFrame outside the actual iFrame but it is not as good as the "close this window" being inside the iframe.

        The code to close the iFrame is :
        [
        function closeiframe(){
        parent.document .getElementById ("iframe1").sty le.display="non e";
        }
        ]

        the square brackets are requested by the site ???

        Thanks

        Comment

        • pronerd
          Recognized Expert Contributor
          • Nov 2006
          • 392

          #5
          Originally posted by jaiwebs
          Thanks for the reply.
          I have been trying to set it all out with the close iFrame outside the actual iFrame but it is not as good as the "close this window" being inside the iframe.

          The code to close the iFrame is :
          [
          function closeiframe(){
          parent.document .getElementById ("iframe1").sty le.display="non e";
          }
          ]

          the square brackets are requested by the site ???

          Thanks
          Ok. So does the code that opens the iFrame reset the display attribute? What is the code that opens the iFrame?

          Comment

          • jaiwebs
            New Member
            • Nov 2006
            • 5

            #6
            I have a hotspot

            <area shape="rect" coords="644,15, 747,33" href="#" onClick="MM_sho wHideLayers('la test','','show' )">

            with the above function generated by dreamweaver mx

            function MM_showHideLaye rs() { //v6.0
            var i,p,v,obj,args= MM_showHideLaye rs.arguments;
            for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findOb j(args[i]))!=null) { v=args[i+2];
            if (obj.style) { obj=obj.style; v=(v=='show')?' visible':(v=='h ide')?'hidden': v; }
            obj.visibility= v; }
            }

            and the iFrame produced with :

            <div id="latest" style="position :absolute; width:450px; height:300px; z-index:1; left: 289px; top: 112px; visibility: hidden;">
            <iframe id="iframe1" name="iframe1" src="latest.htm " align="top" height="300" width="450" hspace="0" vspace="0" frameborder="0" scrolling="auto ">
            Your browser does not support iframes! <br>
            </iframe>
            </div>

            Thanks

            Comment

            • pronerd
              Recognized Expert Contributor
              • Nov 2006
              • 392

              #7
              Originally posted by jaiwebs
              function MM_showHideLaye rs() { //v6.0
              var i,p,v,obj,args= MM_showHideLaye rs.arguments;
              for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findOb j(args[i]))!=null) { v=args[i+2];
              if (obj.style) { obj=obj.style; v=(v=='show')?' visible':(v=='h ide')?'hidden': v; }
              obj.visibility= v; }
              }
              It looks like I was right in the post above. I do not see where the display attribute is being changed back to re-enable the iFrame to be viewed. So after the first time the close function is called the iFrame's display attribute is set to "none" and nothing is changing it back to something that will let it be viewed after that.

              You need something in the function that displays the iFrame to set the display attribute to block, inline, etc.

              Comment

              • jaiwebs
                New Member
                • Nov 2006
                • 5

                #8
                Thanks for the help.
                I have sorted it now with a much simpler method.

                Although it is not as extensive with its browser checking etc. it will do for me.

                The mistake I was making was putting the link to close the layer in the page called by the iFrame.

                see the solution , hope it helps someone:

                This in the head
                function hidelayer(lay) {
                document.all[lay].style.visibili ty = "hidden";

                }
                function showlayer(lay) {
                document.all[lay].style.visibili ty = "visible";

                }


                This in the body :

                <div id="newlayer" style="position :absolute; width:196px; height:286px; z-index:1; left: 50px; top: 131px; visibility: hidden;">

                <a href="javascrip t:hidelayer('ne wlayer');">hide layer</a>

                <iframe id="iframe1" name="iframe1" src="menu.htm" align="top" height="380" width="132" hspace="4" vspace="0" frameborder="0" scrolling="no">
                Your browser does not support iframes! </iframe><br>
                </div>

                Thanks again

                Comment

                Working...