var fgm = { $: function(id) { return typeof id === "object" ? id : document.getElementById(id); }, $$: function(tagName, oParent) { return (oParent || document).getElementsByTagName(tagName); }, $$$: function(className, element, tagName) { var i = 0, aClass = [], reClass = new RegExp("(^|\\s)" + className + "(\\s|$)"), aElement = fgm.$$(tagName || "*", element || document); for (i = 0; i < aElement.length; i++) reClass.test(aElement[i].className) && aClass.push(aElement[i]); return aClass; }, index: function(element) { var aChildren = element.parentNode.children, i; for(i = 0; i < aChildren.length; i++) if(aChildren[i] === element) return i; return -1; }, on: function(element, type, handler) { return element.addEventListener ? element.addEventListener(type, handler, !1) : element.attachEvent("on" + type, handler); }, bind: function(object, handler) { return function() { return handler.apply(object, arguments); }; } }; function Tab(id) { var that = this; this.obj = fgm.$(id); this.oTab = fgm.$$$("tab", this.obj)[0]; this.aTab = fgm.$$("li", this.oTab); this.oSwitch = fgm.$$$("switchBtn", this.oTab)[0]; this.oPrev = fgm.$$("a", this.oSwitch)[0]; this.oNext = fgm.$$("a", this.oSwitch)[1]; this.aItems = fgm.$$$("items", this.obj); this.iNow = 0; fgm.on(this.oSwitch, "click", fgm.bind(this, this.fnClick)); fgm.on(this.oTab, "mouseover", fgm.bind(this, this.fnMouseOver)); } Tab.prototype = { fnMouseOver: function(ev) { var oEv = ev || event, oTarget = oEv.target || oEv.srcElement; oTarget.tagName.toUpperCase() === "LI" && (this.iNow = fgm.index(oTarget)); this.fnSwitch(); }, fnClick: function(ev) { var oEv = ev || event, oTarget = oEv.target || oEv.srcElement, i; switch(fgm.index(oTarget)) { case 0: if(oTarget.className == "prev") { this.aTab[this.iNow].style.display = "block"; this.iNow--; }; break; case 1: if(oTarget.className == "next") { for(i = 0; i < this.iNow; i++) this.aTab[i].style.display = "none"; this.iNow++; }; break; }; this.aTab[this.iNow].style.display = "block"; this.fnSwitch(); }, fnSwitch: function() { for(var i = 0; i < this.aTab.length; i++) (this.aTab[i].className = "", this.aItems[i].style.display = "none"); this.aTab[this.iNow].className = "current"; this.aItems[this.iNow].style.display = "block"; this.oPrev.className = this.iNow == 0 ? "prevNot" : "prev"; this.oNext.className = this.iNow == this.aTab.length - 1 ? "nextNot" : "next"; } }; //应用 fgm.on(window, "load", function() { var aItem = fgm.$$$("item"), i = 0; for(; i < aItem.length; i++) new Tab(aItem[i]); });
不是所有人都敢改变自己,但所有敢于改变自己的人 都将成功!

筑梦程序员,做高品质的IT编程培训机构——北大青鸟西安兆隆

当前位置: 编程培训 > 兆隆专题 >
  • 110条记录
  • 图书通信管理系统2017-08-25 16:22:10
  • BBS在线论坛管理系统2017-08-25 16:08:52
  • 客户关系管理系统2017-08-24 17:23:37
  • 车辆管理系统2017-08-24 16:57:20
  • 便捷超市2017-08-23 16:58:56
  • 吃哪儿—点餐APP2017-08-23 16:58:32
  • 快团APP2017-08-23 16:58:05
  • 物流管理系统2017-08-23 13:36:32
  • 学员作品——西安兆隆2012-09-29 09:08:34
  • 兆隆IT云学院校区乘车路线2012-01-05 10:05:48
  • 图书通信管理系统
    图书通信管理系统
    BBS在线论坛管理系统
    BBS在线论坛管理系
    客户关系管理系统
    客户关系管理系统
    车辆管理系统
    车辆管理系统