codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  toggling between multiple layers.  tbathgate at 10:02 on Wednesday, October 25, 2006
 

Hey All,

I was hoping someone could help me. I'm currently learning the whole dhtml and javascript thing and am having some problems.

I have learnt fine how to make one layer visible and invisible when you click on a link, but i can't quite figure this out.

I have a web page i'm building and what i have is a list of services on it. I wan't it so that when you click on a service a layer becomes visible and when you click on another service the current one(if any) disappears and then the new one becomes visible.

I have created 6 layers called service1 throught to 6 and have done all the formatting with css.

I can get one layer to appear and another to disappear but the code is very clumsy, i have used a functon called ShowContent and a functin called HideContent: javascript:ShowContent('service2') andjavascript:HideContent('service1') etc on each item in the list of services

I had a thought that you could use a nested if statement, or a switch case statement but that code is also clumsy and long.

I know there must be a simple way to do this but i just cannot get my head round it.

My thoughts are that if you have something that gets what link is clicked, ie link1 is clicked which should show the layer service 1, sets all the layers to invisible and then makes the selected layer visible and so on.

Can anyone help me, it would be most appreciated!!!!

Tom








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Checking Multiple Forms on a Sngle Page
•  Address Book Problem
•  How to open files other then virtual folder..
•  please help incompatibility with IE 7
•  DIV Alignment When Text Size Is Changed
•  Why does my menu have specks?
•  moving mouse on the line graph
•  disconnected data
•  DHTML with Active X & codesigning


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2006