Solved

make iframe hidden...

Posted on 2003-11-07
10
239 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
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

773 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