Mel wrote:
[color=blue]
> i need to have 2 side by side iframes, a link on top of the one will
> show/hide the other[/color]
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);
}
when i click on the link, the iframe will not hide, can you please help me ?
thanks a lot
"Martin Honnen" <mahotrash@yaho o.de> wrote in message
news:423eddca$0 $11475$9b4e6d93 @newsread2.arco r-online.net...[color=blue]
>
>
> Mel wrote:
>[color=green]
> > i need to have 2 side by side iframes, a link on top of the one will
> > show/hide the other[/color]
>
> 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/[/color]
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>
--
Mel wrote:[color=blue]
> 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"[/color]
when[color=blue]
> it is visible.[/color]
Have a span surrounding the anchor text that you would like to change.
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>[color=blue]
> 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" <mahotrash@yaho o.de> wrote in message
> news:423ee72b$0 $11476$9b4e6d93 @newsread2.arco r-online.net...[color=green]
> >
> >
> > Mel wrote:
> >[color=darkred]
> > > i tried:
> > > <iframe id="ME" src="http://www.yahoo.com"[/color][/color][/color]
frameborder=1></iframe>[color=blue][color=green][color=darkred]
> > >
> > > <script>
> > > function hideElement (element) {
> > > if (element.style) {
> > > element.style.d isplay = 'none';
> > > }
> > > }
> > >
> > > function showElement (element) {
> > > if (element.style) {
> > > element.style.d isplay = '';
> > > }
> > > }
> > >[/color]
> >[color=darkred]
> > > </script>[/color]
> >
> >[color=darkred]
> > > <a href="#"[/color][/color][/color]
onclick="javasc ript:hideElemen t('ME')">XXXXXX XXXXXX</a>[color=blue][color=green]
> >
> > You need to find the right element object of course as the code[/color][/color]
above[color=blue]
> showed[color=green]
> > <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/[/color][/color]
Comment