I have several tabs that my site changes between using Javascript. When ever a tab is clicked I need to know which one it was and which one I am currently on.
I have done this through the use of if functions(lots!). I now want to add a new tab and I have to expand all my if functions etc.
Is there a different implementation I can use for this, so future adding of tabs is easy and I don’t have to use so many if functions.
I hope I made sense and there is a solution.
The obligatory answer: Use jQuery, and then use jQuery Tabs. The Tabs plugin generates callbacks that pass to it both the tab being shown and the tab being hidden, which should work nicely for you.
If for some reason you are masochistic and enjoy writing plain Javascript for no apparent reason, then you need to post the code you are using so we can better help you.