By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

iFrame will not open second time around

P: 5
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
Nov 14 '06 #1
Share this Question
Share on Google+
7 Replies


P: 5
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
Nov 14 '06 #2

Expert 100+
P: 392
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.
Nov 14 '06 #3

P: 5
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
Nov 14 '06 #4

Expert 100+
P: 392
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?
Nov 15 '06 #5

P: 5
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
Nov 15 '06 #6

Expert 100+
P: 392
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.
Nov 15 '06 #7

P: 5
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
Nov 17 '06 #8

Post your reply

Sign in to post your reply or Sign up for a free account.