Solved

make iframe hidden...

Posted on 2003-11-07
10
232 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
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now