Welcome to WebmasterWorld Guest from 54.146.180.94

Forum Moderators: open

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:

(head)
<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; }
</script>

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

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month