I am getting object expected when the combo "menuTopics calls the function onchange="changeSubjects()", I cant find whats the problem.
Here is the code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>OEE</title>
<link href="pageCSS.css" rel="stylesheet" type="text/css">
<script type="text/JavaScript">
//new Option("text","value")
//this code changes menus
function nullOptions(aMenu){
/*var tot=aMenu.options.length
for (i=0;i<tot;i++)
{
aMenu.options[i]=null
}*/
aMenu.options.length=0;
}
//Rewrites the text and values
function MySubject-1-1(aMenu){
nullOptions(aMenu)
with (aMenu){
options[0]=new Option("Select a Line","none");
options[1]=new Option("BM 1","1");
options[2]=new Option("BM 2","2");
options[0].selected=true
}
}
function MySubject-1-2(aMenu){
nullOptions(aMenu)
with (aMenu){
options[0]=new Option("Select a Line","none");
options[0].selected=true
}
}
function MyTopics1(aMenu){
nullOptions(aMenu)
with (aMenu){
options[0]=new Option("Blow Molding","1");
options[1]=new Option("Receptal","2");
options[0].selected=true
}
}
function go(aMenu){
if (aMenu.options.value!="none")
{
location=aMenu.options[aMenu.selectedIndex].value
}
else
aMenu.options[0].selected=true;
}
function setUp(){
//if (navigator.appName.indexOf("Microsoft")>-1)
{
document.form1.menuTopics.options[0].selected=true;
document.form1.menuSubjects.options[0].selected=true;
document.form1.menuFiles.options[0].selected=true;
}
}
function changeSubjects(){
aMenu=document.form1.menuSubjects
aMenu2=document.form1.menuFiles
aMenu3=document.form1.menuTopics
with (aMenu3){
switch (selectedIndex) {
case 0:
nullOptions(aMenu)
nullOptions(aMenu2)
aMenu.options[0]=new Option("Lines appear here","none")
aMenu3.options[0].selected=true;
history.go(0)
break
case 1:
//computer stuff
nullOptions(aMenu)
nullOptions(aMenu2)
aMenu2.options[0]=new Option("Lines appear here","none")
aMenu2.options[0].selected=true;
MyTopics1(aMenu)
break
}
}
}
function changeFiles(){
aMenu=document.form1.menuSubjects
aMenu2=document.form1.menuFiles
aMenu3=document.form1.menuTopics;
if (aMenu3.selectedIndex==1)
{
with (aMenu){
case 0:
aMenu2.options.length=0;
aMenu2.options[0]=new Option("Lines appear here","none")
aMenu2.options[0].selected=true;
history.go(0)
break
case1:
MySubject-1-1(aMenu)
break
case1:
MySubject-1-2(aMenu)
break
}
}
}
}
</script>
<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function DoNav(theUrl) {
document.location.href = theUrl;
}