tHIS IS MY cODE......Am just a beginner in php i want to create two combo boxes using jscript....
How ...whats wrong in my code...?? i get an error saying final_list[]...null or not defind...or something similer....any help..?plzz...or any suggestions..??
<SCRIPT language=javascript>
<!-- hide jscript from old browsers ---
function refresh_screen()
{
window.location.reload()
}
/****** this object holds all of the key data **********/
function Link(name, url)
{
this.name = name;
this.title = new Array();
this.url = new Array();
}
/**************************************************************/
var names = new Array ();
var temp = new Array ();
var temp2 = new Array ();
var link = new Link ();
var final_list = new Array ();
/******** array declaration... it holds all of the data for the menus ****/
var menu = new Array (
\"Cancer Therapy *Dr. Jalil AL Maskati|Dr. Jalil AL Maskati\",
\"Cardiologist * Dr. Habib Al Tarif|Dr. Habib Al Tarif#\"+
\"Dr. Haider Bader|Dr. Haider Bader\",
\"Chest Diseases*Dr. Mohammed Al-Hoda|Dr. Mohammed Al-Hoda#\"+
\"Dr. Ahmed Mahdi|Dr. Ahmed Mahdi\",
\"Deramatologist*Dr. Sameera Al-Matrook|Dr. Sameera Al-Matrook#\"+
\"Dr. Khalil Al Arrayed|Dr. Khalil Al Arrayed#\"+
\"Dr. Ghalia Dawaigher|Dr. Ghalia Dawaigher\",
\"Ear Nose & Throat*Dr. Abdul Rahman Gareeb|Dr. Abdul Rahman Gareeb#\"+
\"Dr. Ebrahim Al Sindi|Dr. Ebrahim Al Sindi#\"+
\"Dr. Ameen Al Saati|Dr. Ameen Al Saati#\"+
\"Dr. Jaffer Al Abreeq|Dr. Jaffer Al Abreeq\",
\"Obestetrician Gynaecologist*Dr. Affaf Al Hammar|Dr. Affaf Al Hammar\",
\"Orthodontist*Dr. Ibtisam Shaaban|Dr. Ibtisam Shaaban#\",+
\"Orthodontist*Dr. Shoa'a Al Modhahki|Dr. Shoa'a Al Modhahki\",
\"Psychiarist*Dr. Shubbar Al Qaheri|Dr. Shubbar Al Qaheri\" );
/*****************************************************************/
function updateMenus ( what ) {
var n = what.selectedIndex;
what.form.Consultant_Name.length = final_list[n].title.length;
for (var x = 0; x < what.form.Consultant_Name.length; x++)
{
what.form.Consultant_Name.options[x].text = final_list[n].title[x];
what.form.Consultant_Name.options[x].value = final_list[n].url[x];
}
what.form.Consultant_Name.selectedIndex = 0;
}
/**************************************************************/
function give_names ()
{
document.FrontPage_Form1.Consultant_Speciality.length = names.length;
document.FrontPage_Form1.Consultant_Name.length = final_list[0].title.length;
for ( var i=0; i<names.length; i++ )
document.FrontPage_Form1.Consultant_Speciality.options[i].text = final_list[i].name;
for (var x=0; x<final_list[0].url.length; x++)
document.FrontPage_Form1.Consultant_Name.options[x].value = final_list[0].url[x];
for (var x=0; x<final_list[0].title.length; x++)
document.FrontPage_Form1.Consultant_Name.options[x].text = final_list[0].title[x];
}
/**************************************************************/
function createMenus () {
for ( var i=0; i < menu.length; i++ )
{
names[i] = menu[i].split(\"*\");
link = new Link(names[i][0]);
temp[i] = names[i][1].split(\"#\");
final_list[i] = link;
for (var x=0; x<temp[i].length; x++)
{
temp2[x] = temp[i][x].split(\"|\");
final_list[i].url[x] = temp2[x][0];
final_list[i].title[x] = temp2[x][1];
}
}
give_names();
}
/**************************************************************/
// end jscript hiding -->
</SCRIPT>
</head>
<body>
<h1>Search for a Specialist</h1>
<hr color=#0000FF>
<h3>Step 1
</h3>
<p align=left>Choose the type of doctor you want from the specialty list.
</p>
<form method=POST action=--WEBBOT-SELF-->
<p><select size=1 name=Consultant_Speciality onchange=\"updateMenus(this)\">
</select></p>
<h3>Step 2</h3>
<p>Choose Consultant's Name from the list</p>
<p><select size=1 name=Consultant_Name>
</select></p>
<h3>Step 3</h3>