Forum Moderators: open
I show u the JavaScript function code:
function change(objElement) {
objElement.className = "current";
}
the following is the html that implements javascript function:
<ul id="saturday">
<li><a id = "index" href="index.aspx" onclick = change(this)><span>Inicio</span></a> </li>
<li><a href="Default.aspx " id = "contacto" onclick =change(this)><span>Contacto</span></a>
</li>
</ul>
So basically i need a way to switch the active class between the tabs depending on what tabs is clicked .
Anyone have any idea how to do it?
window.onload = function (){
var els = document.getElementsByTagName('A');
var el;
for ( var i=0; (el=els[i++]); ) {
if ( el.href === document.location.href ) ( el.className="current"; }
}
}
Welcome to forum.