Communications Network
Vast Empire  -  New Posts  -  Search  -  Statistics  -  Login 
 
ComNet > Engineering Corps > Archived Engineering Corps ComNet > Something....
 
 
 
Author
Topic:  Something....
Threeof4
ComNet Member
 
[VE-NAVY] Admiral (ADM)
[VE-VEHC] Field Marshal*
 
Post Number:  438
Total Posts:  438
Joined:  Jan 1998
Status:  Offline
  RE: Something....
July 25, 2002 2:13:21 PM    View the profile of Threeof4 

    menuSpace = document.getElementById&&!document.all ? document.getElementById("menu") : menu ;


     //holds all the nodes in the tree
    nodesArray = new Array();  

    //treeNode object 
    
    function treeNode (displayText, state, children, url) {
         //displayText is the value to be displayed on the menu
         //state is wether the menu is expanded or contracted
         //children is an array containing the children of this node
         //url is the link applied to displayText
        this.displayText = displayText;
        this.state = state;
        this.children = children;
        this.url = url;
    }

    function outputDepth (nodeNumber, spacing) {
        this.nodeNumber = nodeNumber;
        this.spacing = spacing;    
    }


     //draws out the menu again

    function redrawMenu () {
         //start at node 0 and get the children.... 
         //recursion without recursion 
    
        newHTML = '';
        
        stack = new Array();

        stack.push(new outputDepth(0,0));      //root node, always!

        while (stack.length >= 1) {
            outputNode = stack.pop();

            currentNode = nodesArray[outputNode.nodeNumber];
            spacing = outputNode.spacing;
            

            leaf = 1;
                
            
            if (currentNode.children.length > 0) {
                leaf = 0;                
            
                 //add the children to the stack
                if (currentNode.state == 1) 
                    for (i=currentNode.children.length - 1; i > -1; i--)    {
                        stack.push(new outputDepth(currentNode.children[i],spacing+1));
                    }
            }
            
             //print out the information for the menu.
            
            for (i = 0; i < spacing; i++)
                newHTML = newHTML + "  ";
            
            if (leaf == 1)
                newHTML = newHTML + "*";

             // expanded
            else if (currentNode.state == 1)
                newHTML = newHTML + '<a href="javascript:actionMenu(' + outputNode.nodeNumber + ',0)">-</a>';
            else 
                newHTML = newHTML + '<a href="javascript:actionMenu(' + outputNode.nodeNumber + ',1)">+</a>';

            if (currentNode.url != 0) 
                newHTML = newHTML + '<a href="' + currentNode.url + '">';
            
            newHTML = newHTML + currentNode.displayText;
            
            if (currentNode.url != 0) 
                newHTML = newHTML + '</a>';

            newHTML = newHTML + '<br>';
            
        }
        menuSpace.innerHTML = newHTML;
    }


     //adds a child node to a previously added node

    function addChild ( parent, child ) {
         //parent is the array address of the parent node
         //child is the array address of the child node
        nodesArray[parent].children.push(child);
    }

     //changes the state of one of the nodes and then redraws the menu.

    function actionMenu ( node, action ) {
         // node is the array address of the parent node
         // action is the new state of the node
         //   0 - collapsed
         //   1 - expanded
        nodesArray[node].state = action;
        redrawMenu();
    }    



    nodesArray.push(new treeNode("Main Menu",0,new Array(),"0"));  //0
        nodesArray.push(new treeNode("First Tier",0,new Array(),"0"));   //1
        addChild(0,1);
            nodesArray.push(new treeNode("Second Tier",0,new Array(),"0"));  //2
            addChild(1,2);
                nodesArray.push(new treeNode("Final Tier",0,new Array(),"http://www.yahoo.com"));  //3
                addChild(2,3);
        nodesArray.push(new treeNode("First Tier-2",0,new Array(),"0"));  //4
        addChild(0,4);
    
    redrawMenu();
  ----------------------- ::Salute:: FM Threeof4 Field Marshal - Vast Empire Notepad Email I'm in hell.
[This message has been edited by Threeof4 (edited July 25, 2002 2:15:20 PM)]
Threeof4
ComNet Member
 
[VE-NAVY] Admiral (ADM)
[VE-VEHC] Field Marshal*
 
Post Number:  438
Total Posts:  438
Joined:  Jan 1998
Status:  Offline
  RE: Something....
July 25, 2002 2:19:27 PM    View the profile of Threeof4 
It does this: Tree Menu I only know that it works in IE 5.50 so if you people with other browsers would please try it.  I'm not too worried about NS 4.7, cause i'm almost positive it won't work, but who knows.  Mainly looking for results in NS 6.0 (aka. Mozilla) and IE 4 and IE 6 Thanks, 3
 
-----------------------
::Salute::
FM Threeof4
Field Marshal - Vast Empire
Notepad
Email
I'm in hell.
Corran
ComNet Member
 
[VE-NAVY] 2nd Lieutenant (2LT)
[VE-VEEC] Chief Editor
 
Post Number:  552
Total Posts:  552
Joined:  Jul 2001
Status:  Offline
  RE: Something....
July 25, 2002 2:39:10 PM    View the profile of Corran 
It works on IE 6.0.
 
-----------------------
Second Lieutenant Corran
VE Today Deputy Editor

CMDR/2LT Corran/Kaph 1-1/Wing I/mSSD Atrus/VE/VEN/(=A=)(=MA=)(=SA=) [LoC]

Thermite 3D Engine :: Thermite Forums :: Sourceforge Page :: Version 0.0.3 is out!
Human Mind Studios :: HMS Forums
Argon Viper
ComNet Expert
 
[VE-ARMY] Sergeant Major
[VE-VEEC] Senior Writer
 
Post Number:  1789
Total Posts:  1789
Joined:  Apr 2001
Status:  Offline
  RE: Something....
July 25, 2002 5:29:59 PM    View the profile of Argon Viper 
Doesn't work on IE 4, only says "menu start here"...
 
-----------------------
Argon Viper
IW COL Argon Viper{ret}
"History is on the move, those who cannot keep up will watch from a distance, and those who get in our way will not watch at all" - Grand Admiral Thrawn
"In combat, second place is only the last to die."- Anonymous
"Condemnation does not liberate, it oppresses" - Carl G Jung
"The only thing that will never change is that everything will change" - Argon Viper
Talon
ComNet Overlord
 
[VE-ARMY] High General
[VE-DJO] Dark Jeedai Master (DJM)
[VE-VEHC] High General
 
Post Number:  1490
Total Posts:  2417
Joined:  Feb 2000
Status:  Offline
  RE: Something....
July 25, 2002 9:15:57 PM    View the profile of Talon 
Works in Mozilla Thanks 3
 
-----------------------
PRF-RC/BG Sierra "Talon" Taurus/HCA-1/VEA/VE[BC][IOC][LoC][SoS][BM][CDS][MSM]
GV-SL/KM "Nightblades"/DC-4/Elite Griffen Sect/VSD-II Griffen/VEDJ/VE[IOC][OQD][WoS 2nd Class]
CEO Sierra "Talon" Taurus/ECHC-1/Endoven/Dome 8473/VEEC/VE
-----------------------
SCAP/COM Vincent "Claw" Taurus/ISD Nemesis/Offensive Fleet/VEN[=A=][LoM][IOC][IC2]
CE Vincent "Claw" Taurus/Endoven/Dome 8457/VEEC/VE
Threeof4
ComNet Member
 
[VE-NAVY] Admiral (ADM)
[VE-VEHC] Field Marshal*
 
Post Number:  438
Total Posts:  438
Joined:  Jan 1998
Status:  Offline
  RE: Something....
July 26, 2002 8:16:42 AM    View the profile of Threeof4 
Hmmmm ok, I guess I'll have to tinker with it a bit to get it to work in IE 4.  (or you could just upgrade, *walks away whistling*) OK This script is for free use by members of the Vast Empire only, but if you do use it, I WANT CREDIT FOR WRITING IT.  No more of this stealing code/images/ whatever for any reason.  If you're gonna borrow someone elses code do the following: a) ask for permission (which i just gave above) b) GIVE CREDIT! * gets off his soap box * 3
 
-----------------------
::Salute::
FM Threeof4
Field Marshal - Vast Empire
Notepad
Email
I'm in hell.
Argon Viper
ComNet Expert
 
[VE-ARMY] Sergeant Major
[VE-VEEC] Senior Writer
 
Post Number:  1789
Total Posts:  1789
Joined:  Apr 2001
Status:  Offline
  RE: Something....
July 26, 2002 5:59:27 PM    View the profile of Argon Viper 
I knew that'd be the response if it was just me 
 
-----------------------
Argon Viper
IW COL Argon Viper{ret}
"History is on the move, those who cannot keep up will watch from a distance, and those who get in our way will not watch at all" - Grand Admiral Thrawn
"In combat, second place is only the last to die."- Anonymous
"Condemnation does not liberate, it oppresses" - Carl G Jung
"The only thing that will never change is that everything will change" - Argon Viper
Talon
ComNet Overlord
 
[VE-ARMY] High General
[VE-DJO] Dark Jeedai Master (DJM)
[VE-VEHC] High General
 
Post Number:  1490
Total Posts:  2417
Joined:  Feb 2000
Status:  Offline
  RE: Something....
July 26, 2002 9:24:06 PM    View the profile of Talon 
No, he always told me the same thing when I was on my 233.
 
-----------------------
PRF-RC/BG Sierra "Talon" Taurus/HCA-1/VEA/VE[BC][IOC][LoC][SoS][BM][CDS][MSM]
GV-SL/KM "Nightblades"/DC-4/Elite Griffen Sect/VSD-II Griffen/VEDJ/VE[IOC][OQD][WoS 2nd Class]
CEO Sierra "Talon" Taurus/ECHC-1/Endoven/Dome 8473/VEEC/VE
-----------------------
SCAP/COM Vincent "Claw" Taurus/ISD Nemesis/Offensive Fleet/VEN[=A=][LoM][IOC][IC2]
CE Vincent "Claw" Taurus/Endoven/Dome 8457/VEEC/VE
Argon Viper
ComNet Expert
 
[VE-ARMY] Sergeant Major
[VE-VEEC] Senior Writer
 
Post Number:  1789
Total Posts:  1789
Joined:  Apr 2001
Status:  Offline
  RE: Something....
July 27, 2002 2:49:23 PM    View the profile of Argon Viper 
Uhhh, Talon, the "" means I'm just kidding 
 
-----------------------
Argon Viper
IW COL Argon Viper{ret}
"History is on the move, those who cannot keep up will watch from a distance, and those who get in our way will not watch at all" - Grand Admiral Thrawn
"In combat, second place is only the last to die."- Anonymous
"Condemnation does not liberate, it oppresses" - Carl G Jung
"The only thing that will never change is that everything will change" - Argon Viper
ComNet > Engineering Corps > Archived Engineering Corps ComNet > Something....  |  New Posts    
 

All times are CST. The time now is 9:20:41 AM
Comnet Jump:

Current Online Members - 0  |  Guests - 72  |  Bots - 1
 
< Contact Us - The Vast Empire >
 
Powered by ComNet Version 7.2
Copyright © 1998-2024 The Imperial Network
 
This page was generated in 0.675 seconds.