473,320 Members | 1,982 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,320 software developers and data experts.

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 35509


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.html" ...></iframe>

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

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

var iframe;
if (document.getElementById && (iframe =
document.getElementById('iframe1'))) {
hideElement(iframe);
}

--

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.display = 'none';
}
}

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

var iframe;
if (document.getElementById && (iframe = document.getElementById('ME'))) {
showElement(iframe);
}

</script>

<BR><BR>
<a href="#" onclick="javascript:hideElement('ME')">XXXXXXXXXXX X</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*******@yahoo.de> wrote in message
news:42***********************@newsread2.arcor-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.html" ...></iframe>

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

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

var iframe;
if (document.getElementById && (iframe =
document.getElementById('iframe1'))) {
hideElement(iframe);
}

--

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.display = 'none';
}
}

function showElement (element) {
if (element.style) {
element.style.display = '';
}
}
</script>
<a href="#" onclick="javascript:hideElement('ME')">XXXXXXXXXXX X</a>


You need to find the right element object of course as the code above showed
<a href="#"
onclick="var iframe;
if (document.getElementById) {
iframe = document.getElementById('ME');
}
if (iframe) {
hideElement(iframe);
}
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*******@yahoo.de> wrote in message
news:42***********************@newsread2.arcor-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.display = 'none';
}
}

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


<a href="#" onclick="javascript:hideElement('ME')">XXXXXXXXXXX X</a>


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

showed <a href="#"
onclick="var iframe;
if (document.getElementById) {
iframe = document.getElementById('ME');
}
if (iframe) {
hideElement(iframe);
}
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="javascript:HideFrame()">Hide Frame</a>

now becomes

<span id="sFrameAnchor"><a href="javascript:HideFrame()">Hide
Frame</a></span>

and
<script language="Javascript">
function HideFrame()
{
var obj = document.getElementById ('sFrameAnchor');
obj.innerHTML = '<a href="javascript:ShowFrame()">Show Frame</a>';
// Set the frame as invisible here - you have the code to do so
return;
}
function ShowFrame()
{
var obj = document.getElementById ('sFrameAnchor');
obj.innerHTML = '<a href="javascript: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*******@yahoo.de> wrote in message
news:42***********************@newsread2.arcor-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.display = 'none';
}
}

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


<a href="#"
onclick="javascript:hideElement('ME')">XXXXXXXXXXX X</a>
You need to find the right element object of course as the code

above showed
<a href="#"
onclick="var iframe;
if (document.getElementById) {
iframe = document.getElementById('ME');
}
if (iframe) {
hideElement(iframe);
}
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
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...
2
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...
4
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)...
1
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...
2
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: ...
1
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...
4
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...
6
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...
15
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...
11
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.