tabs.js 1.0 KB

1234567891011121314151617181920212223242526272829
  1. function tabit(btn){
  2. var idname = new String(btn.id);
  3. var s = idname.indexOf("_");
  4. var e = idname.lastIndexOf("_")+1;
  5. var tabName = idname.substr(0, s);
  6. var id = parseInt(idname.substr(e, 1));
  7. var tabNumber = btn.parentNode.childNodes.length;
  8. for(i=0;i<tabNumber;i++){
  9. //document.getElementById(tabName+"_div_"+i).style.display = "none";
  10. document.getElementById(tabName+"_btn_"+i).className = "";
  11. };
  12. //document.getElementById(tabName+"_div_"+id).style.display = "block";
  13. btn.className = "curr";
  14. };
  15. function etabit(btn){
  16. var idname = new String(btn.id);
  17. var s = idname.indexOf("_");
  18. var e = idname.lastIndexOf("_")+1;
  19. var tabName = idname.substr(0, s);
  20. var id = parseInt(idname.substr(e, 1));
  21. var tabNumber = btn.parentNode.childNodes.length;
  22. for(i=0;i<tabNumber;i++){
  23. document.getElementById(tabName+"_div_"+i).style.display = "none";
  24. document.getElementById(tabName+"_btn_"+i).className = "";
  25. };
  26. document.getElementById(tabName+"_div_"+id).style.display = "block";
  27. btn.className = "curr";
  28. };