Solved

make iframe hidden...

Posted on 2003-11-07
10
247 Views
Last Modified: 2012-06-21
I want to make an iframe hidden without writing all his parents!
i.e.
Without writing like that:
documents.all.<frame_name>.syle="hidden" or whatever it is.

Simply I have an iframe and a close button on it. I wanna close it like using self.close;

Is it possible?

Thanks..

0
Comment
Question by:e116470
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 10

Expert Comment

by:NetGroove
ID: 9700450
Your html for the iframe needs abutton like this:

<html>
<body >
<form>
<input type=button value="Close" onClick="parent.document.getElementById('fr1').style.display='none'">
</form>
</body>
</html>


And in the parents you need a iframe id that is same in all parents. I choosed: fr1

Parents have the iframe definition like this:
<iframe id=fr1 src="closebtn.htm"></iframe>


Good luck,
NetGroove

0
 
LVL 28

Expert Comment

by:sybe
ID: 9700696
maybe this:
documents.all.<frame_name>.height=0;
documents.all.<frame_name>.width=0;

or
document.all.<frame_name>.open;
document.all.<frame_name>.document.write('<html></html>');
document.all.<frame_name>.close;
0
 
LVL 10

Accepted Solution

by:
NetGroove earned 500 total points
ID: 9701835
Here a small extension.

If this is your parent document:

<html>
<body>
<h1>Text</h1>
<hr>
<iframe id=fr1 src="closebtn.htm"></iframe>
<h1>More Text</h1>
</body>
</html>


And this is your iframe document with file name closebtn.htm:

<html>
<body >
<form>
<input type=button value="Close" onClick="parent.document.getElementById('fr1').style.display='none'">
<input type=button value="Blank" onClick="parent.document.getElementById('fr1').style.visibility='hidden'">
</form>
</body>
</html>


Then does the first button Close remove the area where the iframe was placed.
The button Blank does not a remove and therefore a parent content shrink, but it blanks out the area where the iframe region was placed.

Is that what you need?

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 25

Expert Comment

by:devic
ID: 9703541
=)


<div onclick="this.style.display='none'">
    <iframe id=fr1 src="http://www.google.com"></iframe>
    <br><br><br>
    this.close()
</div>
0
 
LVL 25

Expert Comment

by:devic
ID: 9703561
=))

<div>
<iframe id=fr1 src="http://www.google.com"></iframe>
<button onclick="this.parentNode.style.display='none'">self.close()</button>
</div>
0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9704690
devic,  the button is in the iframe.
And there are many parents using the same iframe.

Either I missed the question or you did it.

0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9704695
Oh, and I am now near you :-)

0
 
LVL 25

Expert Comment

by:devic
ID: 9704895
NetGroove,
maybe you are right and welcome :)
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10353011
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: NetGroove {http:#9701835}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question