I have a simple registration form with a dropdown menu for courses (eg. 101 Javascript, 202 ASP). I want to automatically write the course date and tuition to a textbox. I have a hunch that I wanna use a switch statement and that i have to pass the option value as a parameter but I'm stuck at the *dirty details*. Here's what I have sofar.
function getTuitionDate(){
if (document.RegFrm.SelectCourse.options[document.RegFrm.SelectCourse.selectedIndex].value != "" {
Switch (course) {
case 101: document.RegFrm.CourseDate.value = "Jan. 1, 1111";
document.RegFrm.Tuition.value = "$1111"; break;
case 102: document.RegFrm.CourseDate.value = "Dec. 9, 9999;
document.RegFrm.Tuition.value = "$9999"; break;
}
}
}
<form action="formmail.asp" method="post" name="RegFrm">
<select onchange="getTuitionDate()" id="SelectCourse" name="SelectCourse" tabindex="9">
<option selected value="">Select Course
<option value="101">101 Javascript
<option value="102">102 ASP
</select>
...
Date: <input name="CourseDate" type="text" id="CourseDate" size="20" readonly="true>
Tuition: <input name="Tuiton" type="text" id="Tuition" size="12" readonly="true">
Despite the holiday, anyone out there to help??
function getTuitionDate(){
if (document.RegFrm.SelectCourse.options[document.RegFrm.SelectCourse.selectedIndex].value != "" {
Switch (course) {
case 101: document.RegFrm.CourseDate.value = "Jan. 1, 1111";
document.RegFrm.Tuition.value = "$1111"; break;
case 102: document.RegFrm.CourseDate.value = "Dec. 9, 9999;
document.RegFrm.Tuition.value = "$9999"; break;
}
}
}
<form action="formmail.asp" method="post" name="RegFrm">
<select onchange="getTuitionDate()" id="SelectCourse" name="SelectCourse" tabindex="9">
<option selected value="">Select Course
<option value="101">101 Javascript
<option value="102">102 ASP
</select>
...
Date: <input name="CourseDate" type="text" id="CourseDate" size="20" readonly="true>
Tuition: <input name="Tuiton" type="text" id="Tuition" size="12" readonly="true">
Despite the holiday, anyone out there to help??