15. oktober 2001 - 16:14
Der er
3 kommentarer
hjælp til et Menu træ lige som sonofon.dk
jeg er i krise jeg skal have lavet et menu træ noget ligede sonofon.dk men det skal bare være såden at når jeg trykker på et billede som jeg har sat ind så skal der komme nogle undermenuer frem
16. oktober 2001 - 11:02
#3
er du klar her kommer den
<html>
<head>
<title></title>
<style type=\"text/css\">
DIV.clTop{position:absolute; width:170}
DIV.clSub{position:absolute; left:10; width:170}
#divCont{position:relative; visibility:hidden; left:10; top:0; height:400; width:170;}
A.clMain{font-family:Arial, Verdana, Helvetica, Helv; font-size:14px; text-decoration:none; font-weight:bold; color:white}
A.clMain:hover { color:white; text-decoration: none; }
A.clSubb{font-family:Arial, Verdana, Helvetica, Helv; font-size:14px; text-decoration:none; color:white}
A.clSubb:hover { color:white; font-size: small; text-decoration: none;}
#divMain{position:absolute}
</style>
<script type=\"text/javascript\" language=\"JavaScript\">
//Default browsercheck, added to all scripts!
function checkBrowser(){
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie5=(this.ver.indexOf(\"MSIE 5\")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
//added
this.ie4mac=this.ie4 && navigator.userAgent.indexOf(\"Mac\")>-1
this.ie5mac=this.ie5 && navigator.userAgent.indexOf(\"Mac\")>-1
this.ie55=(this.ver.indexOf(\"MSIE 5.5\")>-1 && this.dom)?1:0;
this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.ie5mac)
return this
}
bw=new checkBrowser()
var stayFolded=false
//Do you want images (if not set to 0 and remove the images from the body)?
foldImg=1
//This is the image that it changes to when it expands.
var exImg=new Image(); exImg.src=\'arrow1.gif\'
//This is the image is changes to with it\'s \"unfolded\" or something :}
//Remeber to change the actual images in the page aswell, but remember to
//keep the name of the image.
var unImg=new Image(); unImg.src=\'arrow.gif\'
/************************************************************************************
Making cross-browser objects
************************************************************************************/
function makeMenu(obj,nest){
nest=(!nest) ? \'\':\'document.\'+nest+\'.\'
this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+\"document.layers.\" +obj):0;
this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+\'document.\'+obj):0;
this.ref=bw.dom || bw.ie4? document:bw.ns4?eval(nest+\"document.layers.\" +obj+\".document\"):0;
this.x=(bw.ns4 || bw.ns5)? this.css.left:this.css.pixelLeft;
this.y=(bw.ns4 || bw.ns5)? this.css.top:this.css.pixelTop;
this.height=bw.ns4?this.ref.height:this.el.offsetHeight;
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\')
oTop[3]=new makeMenu(\'divTop4\',\'divCont\')
oTop[4]=new makeMenu(\'divTop5\',\'divCont\')
oTop[5]=new makeMenu(\'divTop6\',\'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\')
oSub[3]=new makeMenu(\'divSub4\',\'divCont.document.divTop4\')
oSub[4]=new makeMenu(\'divSub5\',\'divCont.document.divTop5\')
oSub[5]=new makeMenu(\'divSub6\',\'divCont.document.divTop6\')
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) }
oCont=new makeMenu(\'divCont\')
oCont.showIt()
}
/************************************************************************************
This is the function that changes the sub menus to folded or unfolded state.
************************************************************************************/
function menu(num){
if(bw.bw){
if(!stayFolded){
for(i=0;i<oSub.length;i++){
if(i!=num){
oSub[i].hideIt()
if(foldImg)oTop[i].ref[\"imgA\"+i].src=unImg.src
}
}
for(i=1;i<oTop.length;i++){
oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height)
}
}
if(oSub[num].vis()){
oSub[num].showIt()
if(foldImg)oTop[num].ref[\"imgA\"+num].src=exImg.src
}else{
oSub[num].hideIt()
if(foldImg)oTop[num].ref[\"imgA\"+num].src=unImg.src
}
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(bw.bw) onload=init;
function menu2(num){ // til brug for links der ikke åbner noget
if(bw.bw){
if(!stayFolded){
for(i=0;i<oSub.length;i++){
if(i!=num){
oSub[i].hideIt()
if(foldImg)oTop[i].ref[\"imgA\"+i].src=unImg.src
}
}
for(i=1;i<oTop.length;i++){
oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height)
}
}
}
};
</script>
</head>
<body bgcolor=\"#112233\"><br>
<div id=\"divCont\">
<div id=\"divTop1\" class=\"clTop\"><A class=clMain onfocus=\"this.blur()\" onclick=\"menu2(10)\" href=\"fnet.htm\" target=\"indhold\"><IMG height=12 alt=\"\" src=\"arrow.gif\" width=12 border=0 name=imgA0> Netværk</a><br>
<div id=\"divSub1\" class=\"clSub\">
</div><br>
</div>
<div id=\"divTop2\" class=\"clTop\"><A class=clMain onfocus=\"this.blur()\" onclick=\"menu(1); return false\" href=\"#\"><IMG height=12 alt=\"\" src=\"arrow.gif\" width=12 border=0 name=imgA1> Transmisson</a><br>
<div id=\"divSub2\" class=\"clSub\">
<A class=clSubb href=\"utp.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> UTP</a><br>
<A class=clSubb href=\"stp.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> STP</a><br>
<A class=clSubb href=\"coax.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Koaksialkabel</a><br>
<A class=clSubb href=\"lys.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Fiberoptisk kabel</a><br>
<A class=clSubb href=\"radio.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Radiobølger</a><br>
<A class=clSubb href=\"mikro.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Mikrobøgler</a><br>
<A class=clSubb href=\"satellit.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Satellit systemer</a><br>
<A class=clSubb href=\"ir.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Infrarød</a><br>
</div><br>
</div>
<div id=\"divTop3\" class=\"clTop\"><A class=clMain onfocus=\"this.blur()\" onclick=\"menu(2); return false\" href=\"#\"><IMG height=12 alt=\"\" src=\"arrow.gif\" width=12 border=0 name=imgA2> Fysisk Topologi</a><br>
<div id=\"divSub3\" class=\"clSub\">
<A class=clSubb href=\"fytop.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Fysisk topologi</a><br>
<A class=clSubb href=\"bus.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Bus-topologi</a><br>
<A class=clSubb href=\"stjerne.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Stjerne-topologi</a><br>
<A class=clSubb href=\"ring.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Ring-topologi</a><br>
</div><br>
</div>
<div id=\"divTop4\" class=\"clTop\"><a href=\"\" onfocus=\"this.blur()\" onclick=\"menu(3); return false\" class=\"clMain\"><IMG height=12 alt=\"\" src=\"arrow.gif\" width=12 border=0 name=imgA3> Logisk Topologi</a><br>
<div id=\"divSub4\" class=\"clSub\">
<A class=clSubb href=\"logtyp.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Logisk topologi</a><br>
<A class=clSubb href=\"contention.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Contention</a><br>
<A class=clSubb href=\"token.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Token passing</a><br>
<A class=clSubb href=\"polling.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Polling</a><br>
</div><br>
</div>
<div id=\"divTop5\" class=\"clTop\"><a href=\"\" onfocus=\"this.blur()\" onclick=\"menu(4); return false\" class=\"clMain\"><IMG height=12 alt=\"\" src=\"arrow.gif\" width=12 border=0 name=imgA4> Netværksudstyr</a><br>
<div id=\"divSub5\" class=\"clSub\">
<A class=clSubb href=\"netad.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Netværksadaptere</a><br>
<A class=clSubb href=\"repea.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Repeater</a><br>
<A class=clSubb href=\"hub.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Hubber</a><br>
</div><br>
</div>
<div id=\"divTop6\" class=\"clTop\"><a href=\"\" onfocus=\"this.blur()\" onclick=\"menu(5); return false\" class=\"clMain\"><IMG height=12 alt=\"\" src=\"arrow.gif\" width=12 border=0 name=imgA5> :-)</a><br>
<div id=\"divSub6\" class=\"clSub\">
<A class=clSubb href=\"slut.htm\" target=\"indhold\" onfocus=\"this.blur()\"><IMG height=7 alt=\"\" src=\"square.gif\" width=7 border=0> Slut prut</a><br>
</div><br>
</div>
</div>
</body>
</html>