473,597 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

hide/show an iframe ?

Mel
i need to have 2 side by side iframes, a link on top of the one will
show/hide the other

can someone help me pleeeeezzzzz ?
Jul 23 '05 #1
5 35555


Mel wrote:
i need to have 2 side by side iframes, a link on top of the one will
show/hide the other


An <iframe> element is an element like others, you can (in browsers like
IE 5+, Netscape 6+, Opera 7+) change its CSS display property e.g.
<iframe id="iframe1" src="whatever.h tml" ...></iframe>

function hideElement (element) {
if (element.style) {
element.style.d isplay = 'none';
}
}

function showElement (element) {
if (element.style) {
element.style.d isplay = '';
}
}

var iframe;
if (document.getEl ementById && (iframe =
document.getEle mentById('ifram e1'))) {
hideElement(ifr ame);
}

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Mel
i tried:
<iframe id="ME" src="http://www.yahoo.com" frameborder=1></iframe>

<script>
function hideElement (element) {
if (element.style) {
element.style.d isplay = 'none';
}
}

function showElement (element) {
if (element.style) {
element.style.d isplay = '';
}
}

var iframe;
if (document.getEl ementById && (iframe = document.getEle mentById('ME')) ) {
showElement(ifr ame);
}

</script>

<BR><BR>
<a href="#" onclick="javasc ript:hideElemen t('ME')">XXXXXX XXXXXX</a><BR><BR>

when i click on the link, the iframe will not hide, can you please help me ?

thanks a lot
"Martin Honnen" <ma*******@yaho o.de> wrote in message
news:42******** *************** @newsread2.arco r-online.net...


Mel wrote:
i need to have 2 side by side iframes, a link on top of the one will
show/hide the other


An <iframe> element is an element like others, you can (in browsers like
IE 5+, Netscape 6+, Opera 7+) change its CSS display property e.g.
<iframe id="iframe1" src="whatever.h tml" ...></iframe>

function hideElement (element) {
if (element.style) {
element.style.d isplay = 'none';
}
}

function showElement (element) {
if (element.style) {
element.style.d isplay = '';
}
}

var iframe;
if (document.getEl ementById && (iframe =
document.getEle mentById('ifram e1'))) {
hideElement(ifr ame);
}

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3


Mel wrote:
i tried:
<iframe id="ME" src="http://www.yahoo.com" frameborder=1></iframe>

<script>
function hideElement (element) {
if (element.style) {
element.style.d isplay = 'none';
}
}

function showElement (element) {
if (element.style) {
element.style.d isplay = '';
}
}
</script>
<a href="#" onclick="javasc ript:hideElemen t('ME')">XXXXXX XXXXXX</a>


You need to find the right element object of course as the code above showed
<a href="#"
onclick="var iframe;
if (document.getEl ementById) {
iframe = document.getEle mentById('ME');
}
if (iframe) {
hideElement(ifr ame);
}
return false;">...</a>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4
Mel
thanks a lot for your help. it works fine.

sorry for the next question, but i am a newbeee

i need my link to display "show" when the iframe is hidden and "hide" when
it is visible. i struggled with it for while and now i have "given up :-)"

if its not a bother, can you put me on the right path ?

thanks again

"Martin Honnen" <ma*******@yaho o.de> wrote in message
news:42******** *************** @newsread2.arco r-online.net...


Mel wrote:
i tried:
<iframe id="ME" src="http://www.yahoo.com" frameborder=1></iframe>

<script>
function hideElement (element) {
if (element.style) {
element.style.d isplay = 'none';
}
}

function showElement (element) {
if (element.style) {
element.style.d isplay = '';
}
}
</script>


<a href="#" onclick="javasc ript:hideElemen t('ME')">XXXXXX XXXXXX</a>


You need to find the right element object of course as the code above

showed <a href="#"
onclick="var iframe;
if (document.getEl ementById) {
iframe = document.getEle mentById('ME');
}
if (iframe) {
hideElement(ifr ame);
}
return false;">...</a>
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #5
Mel wrote:
thanks a lot for your help. it works fine.

sorry for the next question, but i am a newbeee

i need my link to display "show" when the iframe is hidden and "hide" when it is visible. Have a span surrounding the anchor text that you would like to change.

<a href="javascrip t:HideFrame()"> Hide Frame</a>

now becomes

<span id="sFrameAncho r"><a href="javascrip t:HideFrame()"> Hide
Frame</a></span>

and
<script language="Javas cript">
function HideFrame()
{
var obj = document.getEle mentById ('sFrameAnchor' );
obj.innerHTML = '<a href="javascrip t:ShowFrame()"> Show Frame</a>';
// Set the frame as invisible here - you have the code to do so
return;
}
function ShowFrame()
{
var obj = document.getEle mentById ('sFrameAnchor' );
obj.innerHTML = '<a href="javascrip t:HideFrame()"> Hide Frame</a>';
// Set the frame as visible here - you have the code to do so
return;
}
</script> i struggled with it for while and now i have "given up :-)"

if its not a bother, can you put me on the right path ?

thanks again

"Martin Honnen" <ma*******@yaho o.de> wrote in message
news:42******** *************** @newsread2.arco r-online.net...


Mel wrote:
i tried:
<iframe id="ME" src="http://www.yahoo.com" frameborder=1></iframe>
<script>
function hideElement (element) {
if (element.style) {
element.style.d isplay = 'none';
}
}

function showElement (element) {
if (element.style) {
element.style.d isplay = '';
}
}
</script>


<a href="#"
onclick="javasc ript:hideElemen t('ME')">XXXXXX XXXXXX</a>
You need to find the right element object of course as the code

above showed
<a href="#"
onclick="var iframe;
if (document.getEl ementById) {
iframe = document.getEle mentById('ME');
}
if (iframe) {
hideElement(ifr ame);
}
return false;">...</a>
--

Martin Honnen
http://JavaScript.FAQTs.com/


Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
883
by: Robb Gilmore | last post by:
Hello, This is probably an easy one, but I have not been able to figure it out so far. I have a tab control on a windows forms app. Depending on some business logic, I need to hide/show some of the individual tabs. The tab page has no "visible" property. The tabpage class has a "hide" method, but this does not seem to make it disappear. I have been able to remove them via something like this:
2
2261
by: Sandra | last post by:
Hello, I want to develop an application for WindowsCE using eMbedded Visual C++ 4.0. Is it possible to add/delete or hide/show toolbars by running the application. e.g. the user choose a menuitem and then a second toolbar should be opened. Can anybody help me??? Many greetings Sandra
4
7992
by: jerryyang_la1 | last post by:
I've found this script that allows be to hide/show form elements.. <script language="JavaScript"><!-- var toggle = true; function show(object) { if (document.layers && document.layers) document.layers.visibility = 'visible'; else if (document.all) { document.all.style.visibility = 'visible';
1
1466
by: Norman | last post by:
Hello All, I have developed the ASP.Net application using .Net 1.1. I want to get one section of the page under hide/show feauture. That means when the user clicks on display I want to display all the controls and data in that section. when the user cliks on hide I want to hide that section so that the screen will be very short to navaigate vertically. All my users uses ie5.+. Thnaks, Norman
2
2570
by: Greg | last post by:
Hello, I am trying to display order ids and order details (order items). I would like to give the user Hide/Show option to either display or hide order details. The page would look like: Expand All Collapse All
1
1516
by: roni | last post by:
hi. i have webform with 4 panel that i switch then in wizard style ( asp 1.1) . i want to know if i can hide/show the asp panel control IN THE CLIENT SIDE ? meaning, show panel 1 . user enter data. switch to panel 2 IN CLIENT SIDE ....till panel 4
4
2279
by: =?Utf-8?B?U3JpZGhhcg==?= | last post by:
Hi, Is it possible to Hide/Show controls during a callback? I have a radio button list that does the callback. When it does the callback I need to refresh the grid to reflect the selected value in the radio button. Also I need to hide some check boxes based on the selected value. The checkboxes and radiobuttons are both server controls. Please let me know. Thanks,
6
16307
elamberdor
by: elamberdor | last post by:
Hi All! Trying to get a drop down hide/show div on a html page triggered by a button in flash. (Intro: Very very Little experience in dynamic flash) setup: html page, flash map on page, button on flash opens info underneath map in a separate div. div that has hide/show content is called "operator" I found this code, but i'm not sure it's what I need, and it's not working... Flash file>button on stage>script:
15
3796
by: worked | last post by:
I have a script that hides / shows form elements, and wrapped in a tab script (tab navigation). When the code is duplicated (per tab content), the hide / show function works for the first tab but breaks in each subsequent tab. Why? Help appreciated! Example: http://geocities.com/edmurphy21/ hide / show script: <script type="text/javascript"> function showHide() { var idx = this.id.split('-'); var sp =...
11
3715
by: dmorand | last post by:
I'm having some trouble with my javascript which is supposed to hide/show a div element. I have to click on the link twice before it'll hide. I can't seem to figure out why the first click does nothing. function hideshow(which){ if (!document.getElementById) return if (which.style.display=="block") which.style.display="none" else which.style.display="block"
0
7962
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8267
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8380
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8024
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5423
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3921
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2394
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1229
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.