Originally Posted By: Roger


<A HREF="#" onclick="switchTab('tab_name_goes_here')">Click me</a>

Then write some JavaScript that hides all of the divs except for the one named.


Roger, I've done this, and it works. Thanks for this tip.

I like the implementation, and I think it does the right thing for the pages I'm using it for. Yes, as was discussed elsewhere in the thread it breaks the "Back" button functionality, but for the places I'm using it, that's fine.

It has one drawback I'd like to work around, though, and I'm wondering if anyone here knows how to work around it.

The A HREF points to "#" meaning "an anchor with no label" which essentially defaults to the top of the page. Meaning that, in this case, each time someone clicks on a tab, they get scrolled back up to the top of the page at the moment they click. Some browsers don't do the scroll, which is nice, but I'd really like it to not do the scrolling on *every* browser. My tabs are always near the top of the page, but not exactly at the top of the page, so sometimes you've scrolled down the page slightly when you hit the tab. So scrolling back up to the top of the page doesn't feel right.

I seem to recall I tried doing A HREF="", and that works on some browsers and not on others.

What I really need is a way for them to click on the tab and have it result in the ONCLICK event, but not have it behave in the way HREFs do. I think I can do an ONCLICK for an IMG, but I don't want to have to make GIF files for every tab name, I want them to be text.

Anyone know of a solution in this case?
_________________________
Tony Fabris