通用滑动门Javscript
http://www.blueidea.com/download/product/2008/5578.asp
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; } }
比较简单的
/*滑动门*/ function show_menu(num){ for(i=0;i<100;i++){ if($('li0'+i)){ $('h0'+i).style.display='none'; $('li0'+i).style.display='none'; $('f0'+i).className='shipin03'; } } $('h0'+num).style.display='block';//触发以后标题块 $('li0'+num).style.display='block';//触发以后信息块 $('f0'+num).className='shipin030';//触发以后TAG样式 }
//原理,隐藏所有,让当前的显示,并设置当前样式