tab切换,滑动门
<SCRIPT type=text/javascript>
jQuery(document).ready(function () {
changediv(["#ha1","#ha2"],["#hw1","#hw2"],"one")
})
function changediv(menus,divs,opclass){
if(menus.length != divs.length){
alert("菜单个数与内容痛");
return false;
}
for(var i=0; i<menus.length;i++){
$(menus[i]).mouseover(function(){
//alert("你搞错没有啊");
// $(this).addClass(opclass).siblings().removeClass("one")
for(var j=0; j<menus.length; j++){
$(menus[j]).removeClass(opclass);
$(divs[j]).css("display","none");
}
//$(this).addClass(opclass);
$(this).addClass(opclass)
$(divs[$(this).index()]).css("display","block");
})
}
}
</SCRIPT>
function scrollDoor(){
}
scrollDoor.prototype = {
sd : 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]).鼠标over事件[请自行修改] = function(){
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;
}
}
jQuery(document).ready(function () {
var SDmodel = new scrollDoor();
SDmodel.sd(["an1", "an2","an3","an4","an5","an6"],["adr1", "adr2", "adr3","adr4","adr5","adr6"],"one");
})