标签切换效果求教!
<script type="text/javascript">
function switchmodTag(){
}
switchmodTag.prototype = {
st : function(menus,divs,openClass,closeClass){
var _this = this;
if(menus.length != divs.length)
{
alert("菜单层数量和内容层数量不一样!");
return false;
}
for(var i = 0 ; i < menus.length ; i++)
{
_this.$(menus[i]).value = i;
_this.$(menus[i]).onclick = function(){//如果想把效果变成点击切换,将此行onmouseover 改成onclick即可。
for(var j = 0 ; j < menus.length ; j++)
{
_this.$(menus[j]).className = closeClass;
_this.$(divs[j]).style.display = "none";
}
_this.$(menus[this.value]).className = openClass;
_this.$(divs[this.value]).style.display = "block";
}
}
},
$ : function(oid){
if(typeof(oid) == "string")
return document.getElementById(oid);
return oid;
}
}
window.onload = function(){
var STmodel = new switchmodTag();
STmodel.st(["a_1","a_2","a_3"],["c1_1","c1_2","c1_3"],"st01","st02");//第一组动滑轮
STmodel.st(["b_1","b_2","b_3","b_4","b_5"],["c2_1","c2_2","c2_3","c2_4","c2_5"],"st101","st102");//第二组动滑轮
STmodel.st(["c_1","c_2","c_3"],["c3_1","c3_2","c3_3"],"st01","st02");//第三组动滑轮
STmodel.st(["d_1","d_2","d_3","d_4"],["c4_1","c4_2","c4_3","c4_4"],"st401","st402");//第四组动滑轮
STmodel.st(["m_1","m_2","m_3","m_4","m_5"],["c5_1","c5_2","c5_3","c5_4","c5_5"],"st201","st202");//第五组动滑轮
STmodel.st(["f_1","f_2","f_3"],["c6_1","c6_2","c6_3"],"st01","st02");//第六组动滑轮
STmodel.st(["g_1","g_2","g_3","g_4","g_5"],["c7_1","c7_2","c7_3","c7_4","c7_5"],"st01","st02");//第七组滑动轮
STmodel.st(["h_1","h_2","h_3","h_4"],["c8_1","c8_2","c8_3","c8_4"],"st301","st302");
STmodel.st(["e_1","e_2","e_3","e_4"],["c9_1","c9_2","c9_3","c9_4"],"st01","st02");
}
</script>
麻烦大家给看一下,为什么最后一组动滑轮,不起作用。!