Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

make iframe hidden...

Posted on 2003-11-07
10
Medium Priority
?
271 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 2000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
Suggested Courses

926 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