Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

need help with nested tabs!



11:06 pm on Jun 24, 2009 (gmt 0)

5+ Year Member

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>


Featured Threads

Hot Threads This Week

Hot Threads This Month