473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Hiding IFrame from within itself

347 100+
I have an iframe that is hidden with CSS on my page and i have it appear when a user clicks on an image to play a video. This is done by loading a seperate page into the IFrame.

Does anyone know how i can hide the iframe from a link within the page that loads in the IFrame?

Thanks

Colin
Jan 31 '12 #1

✓ answered by colinod

Ive managed to sort this myself.

I have this javascript code that i use to show and hide my div
Expand|Select|Wrap|Line Numbers
  1. function toggleVisibility(id, NNtype, IEtype, WC3type) {
  2.     if (document.getElementById) {
  3.         eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
  4.     } else {
  5.         if (document.layers) {
  6.             document.layers[id].visibility = NNtype;
  7.         } else {
  8.             if (document.all) {
  9.                 eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
  10.             }
  11.         }
  12.     }
  13. }
i call this as follows to show

Expand|Select|Wrap|Line Numbers
  1. toggleVisibility('movies','show','visible','visible')
and to hide

Expand|Select|Wrap|Line Numbers
  1. toggleVisibility('movies','hidden','hidden','hidden')
I have put the hide code in my page that is called into the iframe as follows

Expand|Select|Wrap|Line Numbers
  1. window.parent.toggleVisibility('movies','hidden','hidden','hidden')
This works a treat just incase anyone wants to know

colin

1 2269
colinod
347 100+
Ive managed to sort this myself.

I have this javascript code that i use to show and hide my div
Expand|Select|Wrap|Line Numbers
  1. function toggleVisibility(id, NNtype, IEtype, WC3type) {
  2.     if (document.getElementById) {
  3.         eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
  4.     } else {
  5.         if (document.layers) {
  6.             document.layers[id].visibility = NNtype;
  7.         } else {
  8.             if (document.all) {
  9.                 eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
  10.             }
  11.         }
  12.     }
  13. }
i call this as follows to show

Expand|Select|Wrap|Line Numbers
  1. toggleVisibility('movies','show','visible','visible')
and to hide

Expand|Select|Wrap|Line Numbers
  1. toggleVisibility('movies','hidden','hidden','hidden')
I have put the hide code in my page that is called into the iframe as follows

Expand|Select|Wrap|Line Numbers
  1. window.parent.toggleVisibility('movies','hidden','hidden','hidden')
This works a treat just incase anyone wants to know

colin
Jan 31 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: James Wallace | last post by:
I need to know how to change the src property of an iframe from script that is executed in another iframe with both of these iframes being contained on a document which is then contained by another...
2
by: sbeerav | last post by:
Hi, I wanted to know if it is legal in XML to declare an element within itself. For example... <A> This is an element of type A. <A> This is another element of type A </A>
6
by: Jacobus Terhorst | last post by:
Using C#: I tried: ServiceController me = new ServiceController(this.ServiceName); me.Stop(); it raises an exception: Cannot find Service I also tried:
0
by: Brent.Lakatos | last post by:
ASP.NET 2.0 Question: I have a simple IFrame User Control that I wrote: HTML: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="IFrameControl.ascx.cs" Inherits="IFrameControl" %> ...
6
by: shan | last post by:
I used the following code in linked list in C. typedef struct node { int data; struct node *next; //more explanation needed for this line }sll; Is *next a variable to struct node,If...
2
by: Erich93063 | last post by:
I have a page that pops open a window and in that pop up page is an iframe. How can I send information back to the ORIGINAL parent page that popped open the pop up from the iframe page? Hope...
2
by: mvmashraf | last post by:
How can I make an IFRAME resize itself when someone changes their resolution? I have a table in that i am loading that iframe, I did give the width of Iframe and the width of table as 100%, What...
7
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have a WinForm application that, depending on user actions, may spin for a while doing extensive calculations, showing a progress bar in the meantime. I would like to be able to launch a second...
8
by: musicmaster890 | last post by:
I've got an iframe (id='vidiframe') that holds an iframe (id='ytvid') and I'd like to have a link (the link is in a separate iframe too) that would change the contents of that inner-most iframe, but...
7
by: vunet | last post by:
I am still not clear about how to reference an object within another object to pass first object to a function: var Parent = { myFunc : function(){ alert("Parent = "+this) }, Child : { //how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.