I have a tab menu item which onclick hides and shows a div.
Now I have a class which adds style to a active tab.
I am not able to figure out on how to do add this class when a user clicks on it?
Please advice......
Here is my code:
var showid = "div1";
function doInit(id) {
document.getElementById(showid).style.display = "none";
document.getElementById(id).style.display = "";
showid = id;
}
HTML
<div class="Tab"> <a href="#" onclick="doInit('div1');">Tab1</a> </div>
<div class="Tab"> <a href="#" onclick="doInit('div2');">Tab2</a> </div>
<div class="Tab"> <a href="#" onclick="doInit('div3');">Tab3</a> </div>
<div class="Tab"> <a href="#" onclick="doInit('div4');">Tab4</a> </div>
<div style="clear: both;"></div>
CSS
a.active
{
font-weight: bold;
font-size: 12px;
color: #68A710;
background: url('../img/tabbg-on.png') top no-repeat;
position: relative;
}
This post has been edited by kevin_911: 08 August 2012 - 12:13 AM

New Topic/Question
Reply


MultiQuote





|