Ken Ward's Java Script Tutorial ...

JavaScript Triple Menu

Triple drop down menu 4

 

To explore self development and computer stuff: - choose a topic from the drop-down box on the left, then a subject from the box in the middle. And finally choose a page from the drop down menu on the right.

Select a topic ... ... then a subject ... ... and then a page to go ...

 

 

/* ####################### function changeFiles ####################### */

/* #######################

The following code is very similar to the previous one.

####################### */

/* First, get a shorthand way of writing the menus: */

function changeFiles(){

aMenu=document.formTripleMenu.menuSubjects

aMenu2=document.formTripleMenu.menuFiles

aMenu3=document.formTripleMenu.menuTopics;

/* ####################### set of files for option 1 (JavaScript) ####################### */

/* If the user selects the topics menu item 1 then */

if (aMenu3.selectedIndex==1)

{

with (aMenu){

switch (selectedIndex) {

case 0:

aMenu2.options.length=0;

aMenu2.options[0]=

new Option("Pages appear here","none")

aMenu2.options[0].selected=true;

history.go(0)

break

/* and selects the first item in the SUBJECTS menu (JavaScript) then the files' menu is populated with the JavaScript files

This is achieved through the function MySubject1.

*/

case 1:

MySubject1(aMenu2)

/* JavaScript */

break

/* I have snipped some items to make the code clearer */

case 4:

MySubject4(aMenu2)

//Search engine positioning

break

}

}

}

/* ####################### set of files for option 2 Self Development ####################### */

if (aMenu3.selectedIndex==2)

{

with (aMenu){

switch (selectedIndex) {

case 0:

aMenu2.options.length=0;

aMenu2.options[0]=

new Option("Pages appear here","none")

aMenu2.options[0].selected=true;

history.go(0)

break

/* #######################

Note that here, for each new option the functions MySubject become MySubject1a, MySubject1b.

So for the first option they were MySubject1, MySubject2, etc. For the Second MySubject1a, MySubject2a, etc. And so on for the other options.

This is simply the way that I have written the code and you could call your functions what you like.

####################### */

case 1:

MySubject1a(aMenu2)

break

/* I have snipped some of the items to make it clearer */

case 13:

MySubject12a(aMenu2)

break

}

}

}

/* ####################### third set of files for option 3 ####################### */

if (aMenu3.selectedIndex==3)

{

with (aMenu){

switch (selectedIndex) {

case 0:

aMenu2.options.length=0;

aMenu2.options[0]=

new Option("Pages appear here","none")

aMenu2.options[0].selected=true;

history.go(0)

break

case 1:

MySubject1b(aMenu2)

break

/* I have snipped some of the items to make the code clearer */

case 6:

MySubject6b(aMenu2)

break

}

}

}

}

 

Next: Triple Menu 5: Adding the list of files

 

Double drop down menu - click here! You can easily and quickly add a double drop down menu to your site. Click here to find out how.

 


Ken Ward's HTML Guide...

[If you need to learn more about HTML visit the HTML Tutorial]

I am always pleased to hear from you.
Send your comments to


And for some programming for your brain: check out New Life Course