※ 條例式選單 ※
|
<!-- A:hover{color:#0000ff} DIV.clTop{position:absolute; width:120} DIV.clSub{position:absolute; left:10; width:120} #divCont{position:absolute; left:-0; top:200; height:100; width:0;} A.clMain{font-family:標楷體; font-size:18px; text-decoration:none; font-weight:bold; color:black} A.clSubb{font-family:新細明體; font-size:16px; text-decoration:none; color:black} #divMain{position:absolute} //--> <script language="JavaScript"> /************************************************************************************ Change this to false if you want all the submenus to get unfold when you foldout a new one. ************************************************************************************/ var stayFolded=false /************************************************************************************ Browsercheck relative ************************************************************************************/ var n = (document.layers) ? 1:0; var ie = (document.all) ? 1:0; var browser=((n || ie) && parseInt(navigator.appVersion)>=4) /************************************************************************************ Making cross-browser objects ************************************************************************************/ function makeMenu(obj,nest){ nest=(!nest) ? '':'document.'+nest+'.' this.css=(n) ? eval(nest+'document.'+obj):eval('document.all.'+obj+'.style') this.ref=(n) ? eval(nest+'document.'+obj+'.document'):eval('document'); this.height=n?this.ref.height:eval(obj+'.offsetHeight') this.x=(n)? this.css.left:this.css.pixelLeft;this.y=(n)? this.css.top:this.css.pixelTop; this.hideIt=b_hideIt; this.showIt=b_showIt; this.vis=b_vis; this.moveIt=b_moveIt return this } function b_showIt(){this.css.visibility="visible"} function b_hideIt(){this.css.visibility="hidden"} function b_vis(){if(this.css.visibility=="hidden" || this.css.visibility=="hide") return true;} function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y} /************************************************************************************ Initiating the page. Just add to the arrays here to get more menuitems and add divs in the page ************************************************************************************/ function init(){ oTop=new Array() oTop[0]=new makeMenu('divTop1','divCont') oTop[1]=new makeMenu('divTop2','divCont') oTop[2]=new makeMenu('divTop3','divCont') oSub=new Array() oSub[0]=new makeMenu('divSub1','divCont.document.divTop1') oSub[1]=new makeMenu('divSub2','divCont.document.divTop2') oSub[2]=new makeMenu('divSub3','divCont.document.divTop3') for(i=0;i<oSub.length;i++){ oSub[i].hideIt() } for(i=1;i<oTop.length;i++){ oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height) } } /************************************************************************************ This is the function that changes the sub menus to folded or unfolded state. ************************************************************************************/ function menu(num){ if(browser){ if(!stayFolded){ for(i=0;i<oSub.length;i++){ if(i!=num) oSub[i].hideIt() } for(i=1;i<oTop.length;i++){ oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height) } } oSub[num].vis()?oSub[num].showIt():oSub[num].hideIt() for(i=1;i<oTop.length;i++){ if(!oSub[i-1].vis()) oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height+oSub[i-1].height) else oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height) } } } //Initiating the menus onload, if it's a 4.x+ browser. if(browser) onload=init; </script> <body background="jpg/01_bkg1.jpg"> <center> <p> <p> <p> <p> <!--************************************************************************************ Replace your links with the # inside the a tags to get links. ************************************************************************************--> <div id="divCont"> <div id="divTop1" class="clTop" ><a href="#" onclick="menu(0); return false" class="clMain">【Java applets 教學】</a><br> <div id="divSub1" class="clSub"> <a href="43.htm" class="clSubb">水中倒影</a><br> <a href="44.htm" class="clSubb">水中漣漪</a><br> </div><br> </div> <div id="divTop2" class="clTop" ><a href="#" onclick="menu(1); return false" class="clMain">【Java script 教學】</a><br> <div id="divSub2" class="clSub"> <a href="18.htm" class="clSubb">慧星游標</a><br> <a href="23.htm" class="clSubb">精美日曆</a><br> </div><br> </div> <div id="divTop3" class="clTop" ><a href="#" onclick="menu(2); return false" class="clMain">【即時新聞】</a><br> <div id="divSub3" class="clSub"> <a href="new11.htm" class="clSubb">國際新聞</a><br> <a href="new14.htm" class="clSubb">股市新聞</a><br> </div><br> </div> </div> |