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 07-30-2010, 01:59 PM   PM User | #1
daved2424
New Coder

 
Join Date: Mar 2007
Posts: 39
Thanks: 1
Thanked 0 Times in 0 Posts
daved2424 is an unknown quantity at this point
Hide DIV within iFrame

I want to be able to hide a DIV within an iframe from the parent document. The usual document.getElementById('element').style.display="none"; doesn't work as I can't point to elements within the iframe with it. What do I need to add to make it look within the iframe and not the parent document?

Many thanks in advance.
daved2424 is offline   Reply With Quote
Old 07-30-2010, 02:11 PM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
You need to perform a complete reference. Suppose your iframe element has an id, say id="myIframe". Now:
Code:
var myElementInIframe=document.getElementById('myIframe').contentWindow.document.getElementById('element');
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Users who have thanked Kor for this post:
daved2424 (07-30-2010)
Old 07-30-2010, 05:44 PM   PM User | #3
daved2424
New Coder

 
Join Date: Mar 2007
Posts: 39
Thanks: 1
Thanked 0 Times in 0 Posts
daved2424 is an unknown quantity at this point
Great, thank you very much.
daved2424 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 03:06 AM.


Advertisement
Log in to turn off these ads.