Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-23-2007, 11:27 AM   PM User | #1
PJJames
New to the CF scene

 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
PJJames is an unknown quantity at this point
Open / close iframe problem

Hi - first post so be kind!

I have a function that shows/hides an iframe. I actually found the function on this site. Here is the structure:

Mainpage:

Has a link which opens a floating iframe.

Code:
<a href="#" onclick="HideFrameComingSoon()">Click Here</a>

<iframe id="comingsoon" allowtransparency="true" style="display:none;" scrolling="no" src="comingsoon/soon1a.php"></iframe>
<script language="javascript">
<!--
function HideFrameComingSoon() {
var fr = document.getElementById ("comingsoon");
if(fr.style.display=="none") {
fr.style.display="block";
}
else {
fr.style.display="none";
}
}
-->
</script>
iframe :

Code:
<a href="" onClick="parent.HideFrameComingSoon()">Close</a>
This is working great - except when you've opened/hidden the iframe in IE7 and then click to re-open the iframe on the main page you get a 404. Works perfectly in Firefox.

I think it has something to do with the fact that the iframe loads a page within the /comingsoon directory and therefore IE get's confused, but I can't be sure?

Any ideas?
PJJames is offline   Reply With Quote
Old 04-23-2007, 12:04 PM   PM User | #2
napster
New Coder

 
Join Date: Jan 2007
Location: Wales
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
napster is an unknown quantity at this point
Hmm, I'm not a fan of frames.

I can't see the problem. Your aim is to open an iframe when link is clicked, then the iframe contains a link which closes the iframe? Well I tried it and it works for me in both Firefox and IE, so I'm guessing the problem lies with the comingsoon directory or something, but I'm clueless on how to solve that.
__________________
Tom Dean
napster is offline   Reply With Quote
Old 04-23-2007, 12:17 PM   PM User | #3
PJJames
New to the CF scene

 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
PJJames is an unknown quantity at this point
Thanks for giving it a go. Just to make it clear, the iframe opens (via the main link), closes(via the iframe link), then wont open again (via the main link).

Well, it does in Firefox but not in IE7.

Last edited by PJJames; 04-23-2007 at 12:17 PM.. Reason: typo
PJJames is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:47 AM.


Advertisement
Log in to turn off these ads.