tab滑动门通用JS

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>
<html xmlns=””>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>滑动门通用JS</title>
<style type=”text/css”>
<!–
body{margin:0px;padding:0px;font-size:12px;background:#eee;line-height:20px;}
.bodyer{width:760px;margin:20px auto auto;border:1px dotted #ccc;background:#fff;}
.t_rt{text-align:right;}
h1,h2,h3,h4,h5,h6{font-weight:bold;margin:0px;padding:0px;font-size:12px;}
ul,li{margin:0px;padding:0px;}
li{list-style-type:none;}
h1{margin:10px;padding-right:10px;padding-bottom:5px;border-bottom:1px dotted #ccc;}
.preview{margin:10px;padding:10px;overflow:hidden;background:#eee;}
.cont{padding:10px;}
.hidden{display:none;}
h2{margin:0px 10px;background:#ccc;padding:5px;}
.scrolldoorFrame{width:400px;margin:0px auto;overflow:hidden;}
.scrollUl{width:400px;border-bottom:1px solid #CCC;overflow:hidden;height:35px;}
.scrollUl li{float:left;}
.bor03{border:1px solid #ccc;border-top-width:0px;}
.sd01{cursor:pointer;border:1px solid #CCC;background:#FFF;margin:5px;padding:2px;font-weight:bold;}
.sd02{cursor:pointer;border:0px solid #CCC;margin:5px;padding:2px;}
–>
</style>
<script type=”text/javascript”>
/*
十三妖
qq:181907667
msn:wl181907667@hotmail.com
邮箱:thirdteendevil@163.com
*/
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]).onmouseover = 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;
}
}
window.onload = function(){
var SDmodel = new scrollDoor();
SDmodel.sd([“m01″,”m02″,”m03″,”m04″,”m05”],[“c01″,”c02″,”c03″,”c04″,”c05″],”sd01″,”sd02″);
}
</script>
</head>
<body>
<div>
<h1>
滑动门封装类
</h1>

<h2>
效果预览
</h2>

<div>
<div>
<ul>
<li id=”m01″>滑动门</li>
<li id=”m02″>滑动门</li>
<li id=”m03″>滑动门</li>
<li id=”m04″>滑动门</li>
<li id=”m05″>滑动门</li>
</ul>
<div>
<div id=”c01″>
第一层内容
</div>
<div id=”c02″>
第二层内容
</div>
<div id=”c03″>
第三层内容
</div>
<div id=”c04″>
第四层内容
</div>
<div id=”c05”>
第五层内容
</div>
</div>
</div>
</div>

</div>
</body>
</html>

 » 转载请注明来源:网络蛀虫小窝 » 《tab滑动门通用JS》
 » 本站地址:http://www.gomoth.com
  • 您可能感兴趣的相关文章