Solved

make iframe hidden...

Posted on 2003-11-07
10
236 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
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…

930 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

12 Experts available now in Live!

Get 1:1 Help Now