JavaScript Forum JS Made Easy: Free JavaScripts Tutorials Example Code
About This Product
FontsMadeEasy.com
 
The Business Internet
Find it on This page:
 
| Over 5000 Free Fonts | Tutorials | Javascript Forum | Other Javascript Resources | Cheat Sheet

     
Jsmadeeasy Forums Home   Search   Login   Register   Member List  
JS Made Easy  > JavaScript programming  > Refer to Layers  
 
Display using:  
Previous Thread :: Next Thread 
 Author Thread: Refer to Layers
gastonlm is not online. Last active: 7/28/2004 3:52:08 PM gastonlm
Top 25 Poster
Joined: 28 Jul 2004
Total Posts: 4
 
Refer to Layers
Posted: 12 Jun 2002 11:57 AM
I'm working with layers and I'm doing a function to show layers. The function has a parameter which is the name of the layer. But I don't know exactly hoy to do. I'm doing the following:

function showLayer(lyr)
{
if(document.layers["lyr"].style.visibility=='visible')
document.layers["lyr"].style.visibility='hidden';
else
document.layers["lyr"].style.visibility='visible';
}

What Am I doing wrong when I refer to the layer?? How do I do that?

Thanks,
Gaston.

Thanks,
Gaston.
qsaaiman is not online. Last active: 5/30/2006 4:23:08 AM qsaaiman
Top 25 Poster
Joined: 28 Jul 2004
Total Posts: 21
 
Re:
Posted: 13 Jun 2002 02:25 AM
Hey.

I have not used layers all that much. However style sheets can be a b*tch in JavaScript sometimes. Try this function & see if it works, it just handles the visibility differently.

function showLayer(lyr)
{
if(document.layers[lyr].style.display == "") //Visible
document.layers[lyr].style.display = "none"; //Invisible
else
document.layers[lyr].style.display = ""; //Visible
}

HTH.

Quintin Saaiman
Department of Labour
IT Systems

Quintin Saaiman
Previous Thread :: Next Thread 
Page 1 of 1
 
Jsmadeeasy.com  > JS Made Easy  > JavaScript programming  > Refer to Layers