Drop Down Menu

K

kendalk08

This script was written for a different type of menu and i was
changing it around to make it work as a drop down menu. This is a
multi-tiered menu so i must make a separate call for each menu. Anyway
if you could find my error I would be greatful to you. I will point
out where the error comes in down in the script:

Excerpts from index.html
------------------------------------------------------------------------------------------------------------------------------------------------------------
<script language="javascript" src="menubar_vars.js"></script>
<script language="javascript" src="menubar_js.js"></script>

<div id="menu1" class="menubegin">
// The call
<a href="javascript:;" onMouseOver="openMenu(1,0,1);">
<img src="images/banner_02.jpg" width="93" height="29"
border="0">
</a>
<div id="sec_nav1" class="sec_nav">
<div id="tri_nav1" class="tri_nav"></div>
</div>
</div>

menubar_js.js
------------------------------------------------------------------------------------------------------------------------------------------------------------
function openMenu(menu_num, sec_num, depth) {
if(depth == 1) {
navLinks = document.getElementById("sec_nav"+eval(menu_num));
arr = "Menu" + eval(menu_num);
text = "<table width='100%' cellpadding=0 cellspacing=0 border=0
bordercolor='#FFFFFF'>";
navLinks.style.display = "Block";
alert("Depth = 1");
} else if(depth == 2) {
navLinks = document.getElementById("tri_nav"+eval(menu_num));
arr = "Menu" + eval(menu_num) + "_" + eval(sec_num);
text = "<table width='100%' cellpadding=0 cellspacing=0 border=0
bordercolor='#FFFFFF'>";
navLinks.style.display = "Block";
alert("Depth = 2");
} else {
document.getElementById("sec_nav"+eval(menu_num)).innerHTML =
"Script Error. Please Contact a Webmaster";
}
for(var i=1; i <=eval(arr)[2]; i++) {
arr_child = arr+"_"+i;
link_id = eval(arr_child)[1];
if(link_id == "") {
link_id = "#";
}
sec_menu = eval(arr_child)[2];
if(sec_menu == 0) {
text += "<tr><td class='nav'><div align='center' style='padding-
left: 5px; padding-right: 5px;'><a href='"+link_id+"'>"+eval(arr_child)
[0]+"</a></div></td></tr>";
}
// The error comes when this is not called. Therfore i have no second
tier of this application
else {
text += "<tr><td class='nav'><div align='center' style='padding-
left: 5px; padding-right: 5px;'><a href='"+link_id+"' class='sec_nav'
onmouseover='openMenu("+menu_num+","+i+",2);'>"+eval(arr_child)[0]+"</
a></div></td></tr>";
}
}
text += "</table>";
navLinks.innerHTML = text;
}

menubar_vars.js
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Menu tree
// MenuX=new Array(Text to show, Link, number of sub elements, height,
width);

Menu1=new Array("About Us","",10,20,150);
Menu1_1=new Array("Mission","mission.htm",0,20,150);
Menu1_2=new Array("Contact Us","contact.htm",0,0,0);
Menu1_3=new Array("School Board","",3,20,150);
Menu1_3_1=new Array("Members","bdmembers.htm",0,20,150);
Menu1_3_2=new Array("Meetings","bdmeetings.htm",0,0,0);
Menu1_3_3=new Array("Agendas","bdagendas.htm",0,0,0);
Menu1_4=new Array("District Map","map.htm",0,0,0);
Menu1_5=new Array("School Hours","hours.htm",0,0,0);
Menu1_6=new Array("PTO","pto.htm",0,0,0);
Menu1_7=new Array("Employment","",2,20,150);
Menu1_7_1=new Array("Position Vacancies","employ.htm",0,20,150);
Menu1_7_2=new Array("Salary Schedule","salary.htm",0,0,0);
Menu1_8=new Array("Statistics","stats.htm",0,0,0);
Menu1_9=new Array("Important Links","links.htm",0,0,0);
Menu1_10=new Array("Sitemap","sitemap.htm",0,0,0);

Menu2=new Array("People","",11,20,150);
Menu2_1=new Array("School Board Members","bdmembers.htm",0,20,150);
Menu2_2=new Array("Administration","admin.htm",0);
Menu2_3=new Array("Central Office Staff","costaff.htm",0);
Menu2_4=new Array("Alva High School","ahsstaff.htm",0);
Menu2_5=new Array("Alva Middle School","amsstaff.htm",0);
Menu2_6=new Array("Lincoln Elementary","lincstaff.htm",0);
Menu2_7=new Array("Longfellow Elementary","longstaff.htm",0);
Menu2_8=new Array("Washington Elementary","washstaff.htm",0);
Menu2_9=new Array("Cooperative Education Project","coopstaff.htm",0);
Menu2_10=new Array("Transportation Staff","busstaff.htm",0,20,150);
Menu2_11=new Array("E-mail Directory","email.htm",0);

Menu3=new Array("Policies","",8,20,150);
Menu3_1=new Array("Handbooks","handbook.htm",0,20,150);
Menu3_2=new Array("Family Preparedness","family.htm",0);
Menu3_3=new Array("Business Office","businfo.htm",0);
Menu3_4=new Array("Graduation","",4,20,150);
Menu3_4_1=new Array("Requirements","gradreq.htm",0,20,150);
Menu3_4_2=new Array("Academic Achievement","ahs_achieve.htm",0,0,0);
Menu3_4_3=new Array("OHLAP Requirements","ohlap.htm",0,0,0);
Menu3_4_4=new Array("Scholarships","scholarships.htm",0,0,0);
Menu3_5=new Array("Alva High School","",2,20,150);
Menu3_5_1=new Array("Semester Test","ahssemtest.htm",0,20,150);
Menu3_5_2=new Array("Tardy/Absences","ahstardies.htm",0,0,0);
Menu3_6=new Array("Elementary School","elempol.htm",0);
Menu3_7=new Array("Forms","forms.htm",0);
Menu3_8=new Array("Website","website.htm",0);

Menu4=new Array("Student Activities","",5,20,150);
Menu4_1=new Array("AHS Organizations","ahsorg.htm",4,20,150);
Menu4_1_1=new Array("Fine Arts","ahsorg.htm#arts",0,20,150);
Menu4_1_2=new Array("Athletic","ahsorg.htm#sports",0,0,0);
Menu4_1_3=new Array("Career Oriented","ahsorg.htm#career",0,0,0);
Menu4_1_4=new Array("Linguistics","ahsorg.htm#linguistics",0,0,0);
Menu4_2=new Array("AHS Class Sponsors","ahsclass.htm",0,0,0);
Menu4_3=new Array("AHS Athletics","",8,20,150);
Menu4_3_1=new Array("Football","ahsfootb.htm",0,20,150);
Menu4_3_2=new Array("Fast Pitch Softball","ahsfastp.htm",0,0,0);
Menu4_3_3=new Array("Basketball","ahsbasketb.htm",0,0,0);
Menu4_3_4=new Array("Baseball","ahsbaseb.htm",0,0,0);
Menu4_3_5=new Array("Slow Pitch Softball","ahsslowp.htm",0,0,0);
Menu4_3_6=new Array("Golf","ahsgolf.htm",0,0,0);
Menu4_3_7=new Array("Track","ahstrack.htm",0,0,0);
Menu4_3_8=new Array("Tennis","ahstennis.htm",0,0,0);
Menu4_4=new Array("AMS Organizations","amsorg.htm",0,0,0);
Menu4_5=new Array("AMS Athletics","",7,20,150);
Menu4_5_1=new Array("Football","amsfootb.htm",0,20,150);
Menu4_5_2=new Array("Basketball","amsbasketb.htm",0,0,0);
Menu4_5_3=new Array("Baseball","amsbaseb.htm",0,0,0);
Menu4_5_4=new Array("Softball","amssoftb.htm",0,0,0);
Menu4_5_5=new Array("Fast Pitch","amsfastp.htm",0,0,0);
Menu4_5_6=new Array("Track","amstrack.htm",0,0,0);
Menu4_5_7=new Array("Athletic Event Admission","ams_prices.htm",
0,0,0);


Menu5=new Array("Calendars and Schedules","",9,20,170);
Menu5_1=new Array("2007-2008 School Year","yearly.htm",0,20,170);
Menu5_2=new Array("School Hours","hours.htm",0);
Menu5_3=new Array("Lunch and Breakfast","lunch.htm",0);
Menu5_4=new Array("Monthly Calendars","monthly.htm",0);
Menu5_5=new Array("AHS Class Schedule","ahssched.htm",0);
Menu5_6=new Array("AHS Course Descriptions","ahscourses.htm",0);
Menu5_7=new Array("AMS Class Schedule","amssched.htm",0);
Menu5_8=new Array("Oklahoma State Tests","state_tests.htm",0);
Menu5_9=new Array("ACT Test Dates","act.htm",0);
 
K

kendalk08

This script was written for a different type of menu and i was
changing it around to make it work as a drop down menu. This is a
multi-tiered menu so i must make a separate call for each menu. Anyway
if you could find my error I would be greatful to you. I will point
out where the error comes in down in the script:

Excerpts from index.html
------------------------------------------------------------------------------------------------------------------------------------------------------------
<script language="javascript" src="menubar_vars.js"></script>
<script language="javascript" src="menubar_js.js"></script>

<div id="menu1" class="menubegin">
// The call
<a href="javascript:;" onMouseOver="openMenu(1,0,1);">
<img src="images/banner_02.jpg" width="93" height="29"
border="0">
</a>
<div id="sec_nav1" class="sec_nav">
<div id="tri_nav1" class="tri_nav"></div>
</div>
</div>

menubar_js.js
------------------------------------------------------------------------------------------------------------------------------------------------------------
function openMenu(menu_num, sec_num, depth) {
if(depth == 1) {
navLinks = document.getElementById("sec_nav"+eval(menu_num));
arr = "Menu" + eval(menu_num);
text = "<table width='100%' cellpadding=0 cellspacing=0 border=0
bordercolor='#FFFFFF'>";
navLinks.style.display = "Block";
alert("Depth = 1");
} else if(depth == 2) {
navLinks = document.getElementById("tri_nav"+eval(menu_num));
arr = "Menu" + eval(menu_num) + "_" + eval(sec_num);
text = "<table width='100%' cellpadding=0 cellspacing=0 border=0
bordercolor='#FFFFFF'>";
navLinks.style.display = "Block";
alert("Depth = 2");
} else {
document.getElementById("sec_nav"+eval(menu_num)).innerHTML =
"Script Error. Please Contact a Webmaster";
}
for(var i=1; i <=eval(arr)[2]; i++) {
arr_child = arr+"_"+i;
link_id = eval(arr_child)[1];
if(link_id == "") {
link_id = "#";
}
sec_menu = eval(arr_child)[2];
if(sec_menu == 0) {
text += "<tr><td class='nav'><div align='center' style='padding-
left: 5px; padding-right: 5px;'><a href='"+link_id+"'>"+eval(arr_child)
[0]+"</a></div></td></tr>";
}
// The error comes when this is not called. Therfore i have no second
tier of this application
else {
text += "<tr><td class='nav'><div align='center' style='padding-
left: 5px; padding-right: 5px;'><a href='"+link_id+"' class='sec_nav'
onmouseover='openMenu("+menu_num+","+i+",2);'>"+eval(arr_child)[0]+"</
a></div></td></tr>";
}
}
text += "</table>";
navLinks.innerHTML = text;

}

menubar_vars.js
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Menu tree
// MenuX=new Array(Text to show, Link, number of sub elements, height,
width);

Menu1=new Array("About Us","",10,20,150);
Menu1_1=new Array("Mission","mission.htm",0,20,150);
Menu1_2=new Array("Contact Us","contact.htm",0,0,0);
Menu1_3=new Array("School Board","",3,20,150);
Menu1_3_1=new Array("Members","bdmembers.htm",0,20,150);
Menu1_3_2=new Array("Meetings","bdmeetings.htm",0,0,0);
Menu1_3_3=new Array("Agendas","bdagendas.htm",0,0,0);
Menu1_4=new Array("District Map","map.htm",0,0,0);
Menu1_5=new Array("School Hours","hours.htm",0,0,0);
Menu1_6=new Array("PTO","pto.htm",0,0,0);
Menu1_7=new Array("Employment","",2,20,150);
Menu1_7_1=new Array("Position Vacancies","employ.htm",0,20,150);
Menu1_7_2=new Array("Salary Schedule","salary.htm",0,0,0);
Menu1_8=new Array("Statistics","stats.htm",0,0,0);
Menu1_9=new Array("Important Links","links.htm",0,0,0);
Menu1_10=new Array("Sitemap","sitemap.htm",0,0,0);

Menu2=new Array("People","",11,20,150);
Menu2_1=new Array("School Board Members","bdmembers.htm",0,20,150);
Menu2_2=new Array("Administration","admin.htm",0);
Menu2_3=new Array("Central Office Staff","costaff.htm",0);
Menu2_4=new Array("Alva High School","ahsstaff.htm",0);
Menu2_5=new Array("Alva Middle School","amsstaff.htm",0);
Menu2_6=new Array("Lincoln Elementary","lincstaff.htm",0);
Menu2_7=new Array("Longfellow Elementary","longstaff.htm",0);
Menu2_8=new Array("Washington Elementary","washstaff.htm",0);
Menu2_9=new Array("Cooperative Education Project","coopstaff.htm",0);
Menu2_10=new Array("Transportation Staff","busstaff.htm",0,20,150);
Menu2_11=new Array("E-mail Directory","email.htm",0);

Menu3=new Array("Policies","",8,20,150);
Menu3_1=new Array("Handbooks","handbook.htm",0,20,150);
Menu3_2=new Array("Family Preparedness","family.htm",0);
Menu3_3=new Array("Business Office","businfo.htm",0);
Menu3_4=new Array("Graduation","",4,20,150);
Menu3_4_1=new Array("Requirements","gradreq.htm",0,20,150);
Menu3_4_2=new Array("Academic Achievement","ahs_achieve.htm",0,0,0);
Menu3_4_3=new Array("OHLAP Requirements","ohlap.htm",0,0,0);
Menu3_4_4=new Array("Scholarships","scholarships.htm",0,0,0);
Menu3_5=new Array("Alva High School","",2,20,150);
Menu3_5_1=new Array("Semester Test","ahssemtest.htm",0,20,150);
Menu3_5_2=new Array("Tardy/Absences","ahstardies.htm",0,0,0);
Menu3_6=new Array("Elementary School","elempol.htm",0);
Menu3_7=new Array("Forms","forms.htm",0);
Menu3_8=new Array("Website","website.htm",0);

Menu4=new Array("Student Activities","",5,20,150);
Menu4_1=new Array("AHS Organizations","ahsorg.htm",4,20,150);
Menu4_1_1=new Array("Fine Arts","ahsorg.htm#arts",0,20,150);
Menu4_1_2=new Array("Athletic","ahsorg.htm#sports",0,0,0);
Menu4_1_3=new Array("Career Oriented","ahsorg.htm#career",0,0,0);
Menu4_1_4=new Array("Linguistics","ahsorg.htm#linguistics",0,0,0);
Menu4_2=new Array("AHS Class Sponsors","ahsclass.htm",0,0,0);
Menu4_3=new Array("AHS Athletics","",8,20,150);
Menu4_3_1=new Array("Football","ahsfootb.htm",0,20,150);
Menu4_3_2=new Array("Fast Pitch Softball","ahsfastp.htm",0,0,0);
Menu4_3_3=new Array("Basketball","ahsbasketb.htm",0,0,0);
Menu4_3_4=new Array("Baseball","ahsbaseb.htm",0,0,0);
Menu4_3_5=new Array("Slow Pitch Softball","ahsslowp.htm",0,0,0);
Menu4_3_6=new Array("Golf","ahsgolf.htm",0,0,0);
Menu4_3_7=new Array("Track","ahstrack.htm",0,0,0);
Menu4_3_8=new Array("Tennis","ahstennis.htm",0,0,0);
Menu4_4=new Array("AMS Organizations","amsorg.htm",0,0,0);
Menu4_5=new Array("AMS Athletics","",7,20,150);
Menu4_5_1=new Array("Football","amsfootb.htm",0,20,150);
Menu4_5_2=new Array("Basketball","amsbasketb.htm",0,0,0);
Menu4_5_3=new Array("Baseball","amsbaseb.htm",0,0,0);
Menu4_5_4=new Array("Softball","amssoftb.htm",0,0,0);
Menu4_5_5=new Array("Fast Pitch","amsfastp.htm",0,0,0);
Menu4_5_6=new Array("Track","amstrack.htm",0,0,0);
Menu4_5_7=new Array("Athletic Event Admission","ams_prices.htm",
0,0,0);

Menu5=new Array("Calendars and Schedules","",9,20,170);
Menu5_1=new Array("2007-2008 School Year","yearly.htm",0,20,170);
Menu5_2=new Array("School Hours","hours.htm",0);
Menu5_3=new Array("Lunch and Breakfast","lunch.htm",0);
Menu5_4=new Array("Monthly Calendars","monthly.htm",0);
Menu5_5=new Array("AHS Class Schedule","ahssched.htm",0);
Menu5_6=new Array("AHS Course Descriptions","ahscourses.htm",0);
Menu5_7=new Array("AMS Class Schedule","amssched.htm",0);
Menu5_8=new Array("Oklahoma State Tests","state_tests.htm",0);
Menu5_9=new Array("ACT Test Dates","act.htm",0);

I have found the error. If you want to comment on my script feel free
to do so.
 
T

Thomas 'PointedEars' Lahn

kendalk08 said:
[...]

I have found the error. If you want to comment on my script feel free
to do so.

And you had to quote 160 lines for one line of "new" information?

Next Googlot, please.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top