I’ve got a problem that a lot of trial and error has led me to no answer and I didn’t find a thread like this with a quick search online and these forums.
I have a site that uses quite a few layers, as part of the design. I’m using a nav bar on the top to switch layers below with varying content. Each layer with content is the same size and in the same position.
My problem is that when i want one layer to appear, i’d like to have all other layers matching a certain name dissapear, since I’m only looking for one layer to be visible at a time.
Ideally, I’d like to simply have
img src=”about_button.jpg” onclick=”showlayer(‘about’,’1′);”
Where ‘about’ is the section, and page1 is the particular page it shows and all layers are named as div id=”about.page3″ (period included). I’d like to simply write :
function showlayer(section,num)
{
document.all(section.*).style.visibility=”hidden”;
document.all(section.page+num).style.visibility=”visible”;
}
so all layers called about.page4, about.page5 would dissapear. and if i clicked showlayer(‘contact’,’3′), everything would dissapear and the layer called contact.page3 would appear.
Basically its a matter of syntax.
And while its not critical, If someone knows or prefers to write this is a mac-browser friendly syntax, that would help me even more, if not, no biggie.
Thanks for your time.