与网页上相同的tab栏效果

代码:

          var spans = document.getElementsByTagName("span");

          var lis = document.getElementsByTagName("li");

          for(var i = 0;i

          spans[i].index = i;

          spans[i].onmouseover = function(){

                 for(var i = 0;i

                 spans[i].className = "";

            }

           for(var i = 0;i

           lis[i].className = "none";

            }

           lis[this.index].className = "cur";

           this.className = "current";        

}

}

你可能感兴趣的:(JS类)