PHP gevorderde |
|
Hierrn[code]stylern!--rnDIV.clTop{positionabsolute; width170}rnDIV.clSub{positionabsolute; left10; width170}rn#divCont{positionrelative; left100; top0; height400; width170;}rnA.clMain{font-familyArial, Verdana, Helvetica, Helv; font-size14px; text-decorationnone; font-weightbold; colorblack}rnA.clSubb{font-familyArial, Verdana, Helvetica, Helv; font-size14px; text-decorationnone; colorblack}rn#divMain{positionabsolute}rn--rnstylernscript language=JavaScriptrnrnCopyright (C) 1999 Thomas BrattlirnThis script is made by and copyrighted to Thomas Brattli at www.bratta.comrnVisit for more great scripts.rnThis may be used freely as long as this msg is intact!rnrnrnrnThis script is a foldout menu script, all the foldouts willrnstay outfolded in older browsers. Works in ie4+ and ns4+.rnrnTo change where the menu appears change the left and top values of the divContrnin the stylesheets, it's currently placed relative so you canrnplace this menu in tables or similar if you want. Change the rntext colors and size in the A.clMain and A.clSubb classes.rnrnrnrnChange this to false if you want all the submenus to get unfold when yournfoldout a new one.rnrnvar stayFolded=falsernrnrnBrowsercheckrnrnvar n = (document.layers) 10;rnvar ie = (document.all) 10;rnvar browser=((n ie) && parseInt(navigator.appVersion)=4) rnrnrnMaking cross-browser objectsrnrnfunction makeMenu(obj,nest){rn nest=(!nest) '''document.'+nest+'.' rn this.css=(n) eval(nest+'document.'+obj)eval('document.all.'+obj+'.style') rn this.ref=(n) eval(nest+'document.'+obj+'.document')eval('document'); rn this.height=nthis.ref.heighteval(obj+'.offsetHeight')rn this.x=(n) this.css.leftthis.css.pixelLeft;this.y=(n) this.css.topthis.css.pixelTop; rn this.hideIt=b_hideIt; this.showIt=b_showIt; this.vis=b_vis; this.moveIt=b_moveIt rn return thisrn}rnfunction b_showIt(){this.css.visibility=visible}rnfunction b_hideIt(){this.css.visibility=hidden}rnfunction b_vis(){if(this.css.visibility==hidden this.css.visibility==hide) return true;}rnfunction b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}rnrnInitiating the page. Just add to the arrays here to get more menuitemsrnand add divs in the pagernrnfunction init(){rn oTop=new Array()rn oTop[0]=new makeMenu('divTop1','divCont')rn oTop[1]=new makeMenu('divTop2','divCont')rn oTop[2]=new makeMenu('divTop3','divCont')rn oTop[3]=new makeMenu('divTop4','divCont')rn oTop[4]=new makeMenu('divTop5','divCont')rn oTop[5]=new makeMenu('divTop6','divCont')rn oSub=new Array()rn oSub[0]=new makeMenu('divSub1','divCont.document.divTop1')rn oSub[1]=new makeMenu('divSub2','divCont.document.divTop2')rn oSub[2]=new makeMenu('divSub3','divCont.document.divTop3')rn oSub[3]=new makeMenu('divSub4','divCont.document.divTop4')rn oSub[4]=new makeMenu('divSub5','divCont.document.divTop5')rn oSub[5]=new makeMenu('divSub6','divCont.document.divTop6')rn for(i=0;ioSub.length;i++){ oSub[i].hideIt() }rn for(i=1;ioTop.length;i++){ oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height) }rn}rnrnThis is the function that changes the sub menus to folded or unfolded state.rnrnrnfunction menu(num){rn if(browser){rn if(!stayFolded){rn for(i=0;ioSub.length;i++){rn if(i!=num) oSub[i].hideIt()rn }rn for(i=1;ioTop.length;i++){rn oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height)rn }rn }rn oSub[num].vis()oSub[num].showIt()oSub[num].hideIt()rn for(i=1;ioTop.length;i++){ rn if(!oSub[i-1].vis()) oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height+oSub[i-1].height) rn else oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height)rn }rn }rn}rnInitiating the menus onload, if it's a 4.x+ browser.rnif(browser) onload=init;rnrnscriptrnrnHEADrnBODY bgcolor=whitern!--rnReplace your links with the # inside the a tags to get links.rn--rndiv id=divContrn div id=divTop1 class=clTopa href=# onclick=menu(0); return false class=clMain[choice 0]abrrn div id=divSub1 class=clSubrn a href=# class=clSubb-Sub 1abrrn a href=# class=clSubb-Sub 2abrrn a href=# class=clSubb-Sub 3abrrn a href=# class=clSubb-Sub 4abrrn divbrrn divrn div id=divTop2 class=clTopa href=# onclick=menu(1); return false class=clMain[choice 1]abrrn div id=divSub2 class=clSubrn a href=# class=clSubb-Sub 1abrrn a href=# class=clSubb-Sub 2abrrn divbrrn divrn div id=divTop3 class=clTopa href=# onclick=menu(2); return false class=clMain[choice 2]abrrn div id=divSub3 class=clSubrn a href=# class=clSubb-Sub 1abrrn a href=# class=clSubb-Sub 2abrrn a href=# class=clSubb-Sub 3abrrn divbrrn divrn div id=divTop4 class=clTopa href= onclick=menu(3); return false class=clMain[choice 3]abrrn div id=divSub4 class=clSubrn a href=# class=clSubb-Sub 1abrrn a href=# class=clSubb-Sub 2abrrn divbrrn divrn div id=divTop5 class=clTopa href= onclick=menu(4); return false class=clMain[choice 4]abrrn div id=divSub5 class=clSubrn a href=# class=clSubb-Sub 1abrrn a href=# class=clSubb-Sub 2abrrn a href=# class=clSubb-Sub 3abrrn a href=# class=clSubb-Sub 4abrrn a href=# class=clSubb-Sub 5abrrn divbrrn divrn div id=divTop6 class=clTopa href= onclick=menu(5); return false class=clMain[choice 5]abrrn div id=divSub6 class=clSubrn a href=# class=clSubb-Sub 1abrrn divbrrn divrndiv[code]rnZat bij 1stpage inbegrepenrnAls je er eentje met plaatjes wilt kan ik die ook wel regelen |