Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Show div within an iframe
04-06-2010, 06:36 PM #1
- Join Date
- Apr 2010
- Thanked 0 Times in 0 Posts
Show div within an iframe
On my page there's an iframe containing a div which I've hidden with code on the actual iframe page. I want the iframe content only to be accessible by clicking a button on the main page.
Here's the main parts of the code:
Within the iframe:
<html> <head> </head> <body> <div id="div1"> <iframe onload="iFrameHeight()" id="blockrandom" name="iframe" src="http://somewhere.com/" width="100%" height="500" scrolling="auto" align="top" frameborder="0" class="wrapper"> This option will not work correctly. Unfortunately, your browser does not support inline frames.</iframe> </div> <div id="div2"> <input type="button" value="Show/Hide Search" onclick="document.getElementById('blockrandom').contentWindow.showhide('div')"> </div> </body> </html>
If there's something wrong with my code or if there was a way that the iframe page could check if it was loaded on the right page or not would be great although i'm not sure if that's possible.
Any solutions or alternatives are welcome. Thanks.
P.S. This is on Joomla CMS, I don't think it should make a difference but correct me if I'm wrong.
04-06-2010, 07:25 PM #2
The example code you show there doeswhich makes me suspicious that the iframe code is, indeed, from a different domain.Code:src="http://somewhere.com/"
Also, the JS code you show there is *ANCIENT*. It was designed for use with MSIE 4 and Netscape 4, both of which are hopefully dead lo these many years. And it even has support for MSIE 3, in the form of the <!-- and --> crap.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.