homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

need help with nested tabs!

5+ Year Member

Msg#: 3939905 posted 11:06 pm on Jun 24, 2009 (gmt 0)

I am new to javascript and have been working with a small piece of javascript (found online) to achieve a toggle div onclick effect like that of tabs (achieve change in page content effectively without navigating away from the page). unfortunately the tabs do not to work when nested(ie. when you attempt to assign the function to a set of links in one of the divs that toggles in from the first set of links). the author mentioned that just one small modification would allow for nesting, but did not mention what! could someone help me out? much appreciated...
here's the code:

<script type="text/javascript">
var currLayerId = "firstdiv";
function togLayer(id) {
if(currLayerId) setDisplay(currLayerId, "none");
if(id)setDisplay(id, "block");
currLayerId = id; }
function setDisplay(id, value) {
var elm = document.getElementById(id);
elm.style.display = value; }

<td><a href="#" onclick="togLayer('firstdiv'); return false;">Events</a></td>
<td><a href="#" onclick="togLayer('seconddiv'); return false;">Listen</a></td>


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved