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(["hq01","hq02"],["b01","b02"],"hc_sd1","hc_sd2"); SDmodel.sd(["gy01","gy02"],["c01","c02"],"sj_sd1","sj_sd2"); SDmodel.sd(["qg01","qg02"],["d01","d02"],"sj_sd1","sj_sd2"); SDmodel.sd(["cp01","cp02"],["e01","e02"],"cp_sd1","cp_sd2"); SDmodel.sd(["ns01","ns02"],["f01","f02"],"zx_sd1","zx_sd2"); SDmodel.sd(["ns03","ns04"],["g01","g02"],"zx_sd1","zx_sd2"); SDmodel.sd(["ns05","ns06"],["h01","h02"],"zx_sd1","zx_sd2"); SDmodel.sd(["ns07","ns08"],["i01","i02"],"zx_sd1","zx_sd2"); SDmodel.sd(["zr01","zr02"],["j01","j02"],"zr_sd1","zr_sd2");}