Forum Moderators: open
I've got a tabs made with <li>s' and I would like to show active tab with id=current like this:
<ul>
<li id="current"><a href="#">Home</a></li>
<li><a href="#" target="IFRAME">Abroad</a></li>
<li><a href="#" target="IFRAME">World</a></li>
</ul>
and when user clicks for example Abroad -link, id current would go to it's li. As you can see I'm not loading whole page when user clicks something because content is shown in ifame.
I put onClick="this.id='current'" to every <li> but then there will be multiple id=current, so somehow I should change id in <li>. In <li> there could be id=empty and then change these two states.
Thanks in advance!
Best regards,
Tiibou
function myFunction(element){
liArray=document.getElementById("myUL").childNodes;
i=0;
while(liArray[i]){
liArray[i].id="";
i++;
}
element.id="current";
}
<ul id='myUL'>
<li onClick='myFunction(this);'><a href="#">Home</a></li>
<li onClick='myFunction(this);'><a href="#">Abroad</a></li>
<li onClick='myFunction(this);'><a href="#">World</a></li>
</ul>