Connecting Tech Pros Worldwide Help | Site Map

iFrame will not open second time around

Newbie
 
Join Date: Nov 2006
Posts: 5
#1: Nov 14 '06
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
Newbie
 
Join Date: Nov 2006
Posts: 5
#2: Nov 14 '06

re: iFrame will not open second time around


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
Expert
 
Join Date: Nov 2006
Posts: 392
#3: Nov 14 '06

re: iFrame will not open second time around


Quote:

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.
Newbie
 
Join Date: Nov 2006
Posts: 5
#4: Nov 14 '06

re: iFrame will not open second time around


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").style.di splay="none";
}
]

the square brackets are requested by the site ???

Thanks
Expert
 
Join Date: Nov 2006
Posts: 392
#5: Nov 15 '06

re: iFrame will not open second time around


Quote:

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").style.di splay="none";
}
]

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?
Newbie
 
Join Date: Nov 2006
Posts: 5
#6: Nov 15 '06

re: iFrame will not open second time around


I have a hotspot

<area shape="rect" coords="644,15,747,33" href="#" onClick="MM_showHideLayers('latest','','show')">

with the above function generated by dreamweaver mx

function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'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
Expert
 
Join Date: Nov 2006
Posts: 392
#7: Nov 15 '06

re: iFrame will not open second time around


Quote:

Originally Posted by jaiwebs

function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'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.
Newbie
 
Join Date: Nov 2006
Posts: 5
#8: Nov 17 '06

re: iFrame will not open second time around


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.visibility = "hidden";

}
function showlayer(lay) {
document.all[lay].style.visibility = "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="javascript:hidelayer('newlayer');">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
Reply