hice hace unos dias este codigo para hacer tabs facilmente (estaba aburrido

Código javascript:
Modo de uso:Ver original
var EasyTabs=(function(ele,actived){ var el=document.getElementById(ele); var links=[]; var dom=el.getElementsByTagName('a'); for(var i=0;i<dom.length;i++){ var uid=(((dom[i].getAttribute('href'))).split('#'))[1].replace('#',''); links.push(uid); if(dom[i].parentNode.getAttribute('actived')=="true"){ dom[i].parentNode.className+=(dom[i].parentNode.className?' ':'')+actived; document.getElementById(uid).style.display='block'; }else{ document.getElementById(uid).style.display='none'; } dom[i].onclick=function(){ domLi=el.getElementsByTagName('li'); idA=(((this.getAttribute('href')).split('#'))[1].replace('#','')); for(var j=0;j<domLi.length;j++){ domLi[j].className=this.className.replace(new RegExp("(^|\\s+)"+actived+"(\\s+|$)"), ' '); } this.parentNode.className+=(this.parentNode.className?' ':'')+actived; for(var i=0;i<links.length;i++){ document.getElementById(links[i]).style.display='none' } if(document.getElementById(idA)) document.getElementById(idA).style.display='block'; return false; }; dom[i].onfocus=function(){this.blur();}; } }); // EasyTabs('ID DE LOS TABS','NOMBRE DE LA CLASS CUANDO ESTA ACTIVADA');
Código html:
y el code js:Ver original
Código javascript:
Ver original
EasyTabs('tabs','actived');
DEMO: http://www.halfmusic.com/easytabs.html
Salu2