最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
JS使用面向对象技术实现的tab选项卡效果示例
时间:2017-05-09 编辑:简简单单 来源:一聚教程网
代码如下:
html:
代码如下 | 复制代码 |
|
js:
代码如下 | 复制代码 |
functionscrollDoor(){ } scrollDoor.prototype = { sd :function(menus,divs,openClass,closeClass){ var_this =this; if(menus.length != divs.length) { alert("菜单层数量和内容层数量不一样!"); returnfalse; } for(vari = 0 ; i < menus.length ; i++) { _this.$(menus[i]).value = i; _this.$(menus[i]).onmouseover =function(){ //1.先关闭所有的导航和内容: for(varj = 0 ; j < menus.length ; j++) { _this.$(menus[j]).className = closeClass; _this.$(divs[j]).style.display ="none"; } //2.打开当前的导航和内容: //_this.$(menus[this.value]).className = openClass; this.className = openClass; _this.$(divs[this.value]).style.display ="block"; } } }, $ :function(oid){ if(typeof(oid) =="string") returndocument.getElementById(oid); returnoid; } } window.onload =function(){ varSDmodel =newscrollDoor(); SDmodel.sd(["m01","m02"],["c01","c02"],"sd01","sd02"); //SDmodel.sd(["m001","m002"],["c001","c002"],"sd01","sd02"); } |
-
下一个: canvas红包照片实例分享
相关文章
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31
- 使用HTML截图并保存为本地图片的代码展示 10-31