分步解析JavaScript实现tab选项卡自动切换功能(3)

不断调用此函数就实现了自动切换功能。
如果当前的索引等于li元素的个数,那么就将其设置为0,也就是从头进行新一轮切换。
然后调用对应的方法,并且让索引值自增。

(38)实现了选项卡的切换显示隐藏和样式设置效果

.fnClick : function(oBtn, dis){ var index = 0; for(index=0;index<this.aLi.length;index++){ this.aLi[index].className = ''; this.aCont[index].style.display = 'none'; } this.aLi[oBtn].className = dis; this.aCont[oBtn].style.display = 'block'; }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgwggg.html