Avatar billede rolflagoni Nybegynder
18. april 2006 - 15:39 Der er 1 kommentar og
1 løsning

Rettelser til dropdownmenu

Hej med jer. Jeg har lavet nedenstående menu udfra en guide jeg har fundet her på eksperten. Jeg er ingen haj til java, men måske i kunne hjælpe mig?

1. Kan man fjerne spørgsmålstegnet til hjælpen?
2. hvordan sørger jeg for at hele menuen er foldet ud fra start?
3. Kan jeg på en eller anden måde sørge for at Installations, og Products ikke har et link tilknyttet sig?
4 er det muligt at kunne angive hvor i menuen jeg er - dvs. eventuelt markeret med fed?
5. Er det muligt at når man folder en menu ud, så folder de andre sammen?

På forhånd tak

Rolf

////

<HTML>

                                <HEAD>
                                    <TITLE>JavaScript Menu 1.0</TITLE>
                                    <SCRIPT LANGUAGE="JavaScript1.2"><!--
if (document.layers) NS4 = 1; else NS4 = 0; if (document.all) IE4 = 1; else IE4 = 0; function display(id, str) { if (NS4) { with (document[id].document) { open(); write(str); close(); } } else { document.all[id].innerHTML = str; } }; function repstr(_in,_rep) { out = ""; for(_c=0; _c<_rep; _c++) out = out + _in; return out }; function showtree(node,level,str,expand) { if ( node.childs() == 0 ) { str = str + repstr("&nbsp;",level*4) + "<A HREF=\"" + node.url + "\" TARGET=" + menu_frame + " onMouseOver=\"window.status='" + node.text + "';return true\" onMouseOut=\"window.status='';return true\">-" + node.text + "</A><BR>"; } else { if ( expand == 0 ) { str = str + repstr("&nbsp;",level*4) + "<A HREF=\"java script:toggle('" + node.name + "')\" onMouseOver=\"window.status='" + node.text + "';return true\" onMouseOut=\"window.status='';return true\">" + node.text + "</A><BR>"; } if ( expand == 1 ) { str = str + repstr("&nbsp;",level*4) + node.text + "<BR>"; } } if ( ( ( node.unfold == 1 ) || ( expand == 1 ) ) && ( node.childs() > 0 ) ) { for (node.movefirst() ; node.notlastchild() ; node.movenext() ) { str = showtree(node.getchild(),level + 1,str,expand); } } return str; }; function toggle(name) { node = findnode(MyNode,eval(name)); if ( node.unfold == 0 ) { node.unfold = 1; } else { node.unfold = 0; } updatemenu(); }; function updatemenu() { str = '<P><A HREF="java script:showhelp()">?</A>&nbsp;'; display("menu",showtree(MyNode,0,str,0) + "</P>"); }; function showhelp() { str = '<P><A HREF="java script:updatemenu()">!</A>&nbsp;<A HREF="java script:updatemenu()">menu</A><BR><BR>Click in the menu, to view the submenu and links.</P>'; display("menu",str); }; function Node_childs() { return this.child.length; }; function Node_movefirst() { this.cchild = 0; }; function Node_movenext() { this.cchild++; }; function Node_notlastchild() { if ( this.cchild < this.childs() ) return 1; else return 0; }; function Node_getchild() { return this.child[this.cchild]; }; function Node(_text,_url) { this.text = _text; this.url = _url; this.unfold = 0; this.child = []; this.cchild = 0; this.childs = Node_childs; this.notlastchild = Node_notlastchild; this.movefirst = Node_movefirst; this.movenext = Node_movenext; this.getchild = Node_getchild; this.name = Math.random(); return this; }; function findnode(node,name) { if ( node.name == name ) return node; if ( node.childs() > 0 ) { for (node.movefirst(); node.notlastchild() ; node.movenext() ) { temp = findnode(node.getchild(),name); if ( temp != null ) return temp; } } return null; }
var menu_frame = "gallery";
var MyNode = new Node("<b>Categories</b>");
MyNode.child[0] = new Node("<b>Installations</b>");
    MyNode.child[1] = new Node("1 Central Sterilisation Department","");
    MyNode.child[1].child[0] = new Node("1 Dirty room","Galleries/Installations/1 Central Sterilisation Department/1 Dirty room/index.html");
    MyNode.child[1].child[1] = new Node("2 Clean room","Galleries/Installations/1 Central Sterilisation Department/2 Clean room/index.html");
    MyNode.child[1].child[2] = new Node("3 Sterile room","Galleries/Installations/1 Central Sterilisation Department/3 Sterile room/index.html");
    MyNode.child[1].child[3] = new Node("4 Link to OR","Galleries/Installations/1 Central Sterilisation Department/4 Link to OR/index.html");
MyNode.child[2] = new Node("2 Operating Theatre","");
MyNode.child[2].child[0] = new Node("1 Scrub room","Galleries/Installations/2 Operating Theatre/1 Scrub room/index.html");
MyNode.child[2].child[1] = new Node("2 Induction","Galleries/Installations/2 Operating Theatre/2 Induction/index.html");
MyNode.child[2].child[2] = new Node("3 Operating room","Galleries/Installations/2 Operating Theatre/3 Operating room/index.html");
MyNode.child[2].child[3] = new Node("4 Recovery","Galleries/Installations/2 Operating Theatre/4 Recovery/index.html");
MyNode.child[2].child[4] = new Node("5 Storage","Galleries/Installations/2 Operating Theatre/5 Storage/index.html");
MyNode.child[2].child[5] = new Node("6 Day treatment","Galleries/Installations/2 Operating Theatre/6 Day treatment/index.html");
    MyNode.child[3] = new Node("3 Pharmacy","");
    MyNode.child[3].child[0] = new Node("1 Reception & administration","Galleries/Installations/3 Pharmacy/1 Reception & administration/index.html");
    MyNode.child[3].child[1] = new Node("2 Storage non-sterile","Galleries/Installations/3 Pharmacy/2 Storage non-sterile/index.html");
    MyNode.child[3].child[2] = new Node("3 Sterile storage","Galleries/Installations/3 Pharmacy/3 Sterile storage/index.html");
    MyNode.child[3].child[3] = new Node("4 Distribution","Galleries/Installations/3 Pharmacy/4 Distribution/index.html");
MyNode.child[4] = new Node("4 Central Warehouse","");
MyNode.child[4].child[0] = new Node("1 Reception & administration","Galleries/Installations/4 Central Warehouse/1 Reception & administration/index.html");
MyNode.child[4].child[1] = new Node("2 Central Storage","Galleries/Installations/4 Central Warehouse/2 Central Storage/index.html");
MyNode.child[4].child[2] = new Node("3 Transport","Galleries/Installations/4 Central Warehouse/3 Transport/index.html");
    MyNode.child[5] = new Node("5 Nursing department","");
    MyNode.child[5].child[0] = new Node("1 Reception & administration","Galleries/Installations/5 Nursing department/1 Reception & administration/index.html");
    MyNode.child[5].child[1] = new Node("2 Storage","Galleries/Installations/5 Nursing department/2 Storage/index.html");
    MyNode.child[5].child[2] = new Node("3 Transport","Galleries/Installations/5 Nursing department/3 Transport/index.html");
MyNode.child[6] = new Node("6 Intensive Care","Galleries/Installations/6 Intensive Care/index.html");
    MyNode.child[7] = new Node("7 Emergency","Galleries/Installations/7 Emergency/index.html");
MyNode.child[8] = new Node("8 Other departments","Galleries/Installations/8 Other departments/index.html");
   
// OG HER KOMMER PRODUKT BILLEDERNE//

    MyNode.child[9] = new Node("<b>Products</b>");
MyNode.child[10] = new Node("1 Basic System","");
MyNode.child[10].child[0] = new Node("1 Trays and lids","Galleries/Products/1 Basic System/1 Trays and lids/index.html");
MyNode.child[10].child[1] = new Node("2 Baskets","Galleries/Products/1 Basic System/2 Baskets/index.html");
MyNode.child[10].child[2] = new Node("3 Special modules","Galleries/Products/1 Basic System/3 Special modules/index.html");
MyNode.child[10].child[3] = new Node("4 Accessories Modules","Galleries/Products/1 Basic System/4 Accessories Modules/index.html");
MyNode.child[10].child[4] = new Node("5 Separations and inserts","Galleries/Products/1 Basic System/5 Separations and inserts/index.html");
MyNode.child[10].child[5] = new Node("6 Inserts for medicines","Galleries/Products/1 Basic System/6 Inserts for medicines/index.html");
MyNode.child[10].child[6] = new Node("7 Sheets and wired shelves","Galleries/Products/1 Basic System/7 Sheets and wired shelves/index.html");
MyNode.child[10].child[7] = new Node("8 Instrument trays - desinfection","Galleries/Products/1 Basic System/8 Instrument trays - desinfection/index.html");
    MyNode.child[11] = new Node("2 Cart System","");
    MyNode.child[11].child[0] = new Node("1 ABCD carts","Galleries/Products/2 Cart System/1 ABCD carts/index.html");
    MyNode.child[11].child[1] = new Node("2 Accessories","Galleries/Products/2 Cart System/2 Accessories/index.html");
    MyNode.child[11].child[2] = new Node("3 Open transport","Galleries/Products/2 Cart System/3 Open transport/index.html");
    MyNode.child[11].child[3] = new Node("4 Closed transport","Galleries/Products/2 Cart System/4 Closed transport/index.html");
    MyNode.child[11].child[4] = new Node("5 Linen and waste transport","Galleries/Products/2 Cart System/5 Linen and waste transport/index.html");
    MyNode.child[11].child[5] = new Node("6 Case carts","Galleries/Products/2 Cart System/6 Case carts/index.html");
    MyNode.child[11].child[6] = new Node("7 Other carts","Galleries/Products/2 Cart System/7 Other carts/index.html");
MyNode.child[12] = new Node("3 Scancell System","");
MyNode.child[12].child[0] = new Node("1 Carts","");
MyNode.child[12].child[0].child[0] = new Node("1 Open with Vario walls","Galleries/Products/3 Scancell System/1 Carts/1 Open with Vario walls/index.html");
MyNode.child[12].child[0].child[1] = new Node("2 Closed with rolling front","Galleries/Products/3 Scancell System/1 Carts/2 Closed with rolling front/index.html");
MyNode.child[12].child[0].child[2] = new Node("3 Closed with doors","Galleries/Products/3 Scancell System/1 Carts/3 Closed with doors/index.html");
MyNode.child[12].child[0].child[3] = new Node("4 Closed with drawers","Galleries/Products/3 Scancell System/1 Carts/4 Closed with drawers/index.html");
MyNode.child[12].child[0].child[4] = new Node("5 Multi-function carts","Galleries/Products/3 Scancell System/1 Carts/5 Multi-function carts/index.html");
MyNode.child[12].child[1] = new Node("2 Accessories","");
MyNode.child[12].child[1].child[0] = new Node("1 Top plates","Galleries/Products/3 Scancell System/2 Accessories/1 Top plates/index.html");
MyNode.child[12].child[1].child[1] = new Node("2 Functional rails","Galleries/Products/3 Scancell System/2 Accessories/2 Functional rails/index.html");
MyNode.child[12].child[1].child[2] = new Node("3 Rubbing guards","Galleries/Products/3 Scancell System/2 Accessories/3 Rubbing guards/index.html");
MyNode.child[12].child[1].child[3] = new Node("4 Lock systems","Galleries/Products/3 Scancell System/2 Accessories/4 Lock systems/index.html");
MyNode.child[12].child[1].child[4] = new Node("5 Insertion","Galleries/Products/3 Scancell System/2 Accessories/5 Insertion/index.html");
MyNode.child[12].child[1].child[5] = new Node("6 Fronts","Galleries/Products/3 Scancell System/2 Accessories/6 Fronts/index.html");
MyNode.child[12].child[1].child[6] = new Node("7 Wall rail","Galleries/Products/3 Scancell System/2 Accessories/7 Wall rail/index.html");
MyNode.child[12].child[2] = new Node("3 Cabinets","Galleries/Products/3 Scancell System/3 Cabinets/index.html");
MyNode.child[12].child[3] = new Node("4 Colours","Galleries/Products/3 Scancell System/4 Colours/index.html");
    MyNode.child[13] = new Node("4 Storage System","");
    MyNode.child[13].child[0] = new Node("1 Cabinets","");
    MyNode.child[13].child[0].child[0] = new Node("1 Open cabinets","Galleries/Products/4 Storage System/1 Cabinets/1 Open cabinets/index.html");
    MyNode.child[13].child[0].child[1] = new Node("2 With drawers","Galleries/Products/4 Storage System/1 Cabinets/2 With drawers/index.html");
    MyNode.child[13].child[0].child[2] = new Node("3 With rolling front","Galleries/Products/4 Storage System/1 Cabinets/3 With rolling front/index.html");
    MyNode.child[13].child[0].child[3] = new Node("4 With doors","Galleries/Products/4 Storage System/1 Cabinets/4 With doors/index.html");
    MyNode.child[13].child[0].child[4] = new Node("5 Accessories","Galleries/Products/4 Storage System/1 Cabinets/5 Accessories/index.html");
    MyNode.child[13].child[1] = new Node("2 Racks","");
    MyNode.child[13].child[1].child[0] = new Node("1 Scanmo","Galleries/Products/4 Storage System/2 Racks/1 Scanmo/index.html");
    MyNode.child[13].child[1].child[1] = new Node("2 Mema","Galleries/Products/4 Storage System/2 Racks/2 Mema/index.html");
    MyNode.child[13].child[1].child[2] = new Node("3 Pallet","Galleries/Products/4 Storage System/2 Racks/3 Pallet/index.html");
    MyNode.child[13].child[2] = new Node("3 Panels","Galleries/Products/4 Storage System/3 Panels/index.html");
    MyNode.child[13].child[3] = new Node("4 Tables & tops","Galleries/Products/4 Storage System/4 Tables & tops/index.html");
    MyNode.child[13].child[4] = new Node("5 Refrigerators","Galleries/Products/4 Storage System/5 Refrigerators/index.html");
MyNode.child[14] = new Node("5 Identification System","");
MyNode.child[14].child[0] = new Node("1 Labels","Galleries/Products/5 Identification System/1 Labels/index.html");
MyNode.child[14].child[1] = new Node("2 Scanner","Galleries/Products/5 Identification System/2 Scanner/index.html");
MyNode.child[14].child[2] = new Node("3 Transponder","Galleries/Products/5 Identification System/3 Transponder/index.html");
MyNode.child[14].child[3] = new Node("4 Others","Galleries/Products/5 Identification System/4 Others/index.html");
    MyNode.child[15] = new Node("6 Others","Galleries/Products/6 Others/index.html");

</SCRIPT>
                                    <STYLE>

a {text-decoration: none; color: black; font-family: verdana; font-size: 8;}
p {text-decoration: none; color: black; font-family: verdana; font-size: 8;}
</STYLE>
                                </HEAD>

                                <BODY onLoad="if ( ( NS4 == 1 ) || ( IE4 == 1 ) ) setTimeout('updatemenu()',1)">
                                    <SCRIPT>document.write(menu_title);</SCRIPT>
                                    <P>
                                    <DIV ID="menu" STYLE="position: absolute;">
                                        <SCRIPT>if ( ( NS4 != 1 ) && ( IE4 != 1 ) ) document.write(showtree(MyNode,0,'',1))</SCRIPT>
                                        <NOSCRIPT>
                                            Dette er en javascript menu. Din browser understøtter desværre ikke javascript
                                        </NOSCRIPT>
                                    </DIV>
                                    <BR>
                                    <BR>
                                    <BR>
                                    <BR>
                                    <BR>
                                    <BR>
                                    <BR>
                                    <BR>
                                    <BR>
                                    <BR>
                                    <BR>
                                    <BR>
                                    <br>
                                    <hr</BODY>
                               

                            </HTML>
Avatar billede fsconsult.dk Nybegynder
18. april 2006 - 15:56 #1
prøv at flytte spørgsmålet til javascript ;-)
Avatar billede rolflagoni Nybegynder
20. januar 2007 - 16:33 #2
Lukker og slukker
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester