I have the task of adding a value to a textbox based on the selected value in a combo box. The trouble is, I cant seem to access the selected content in the combo box so as to store it in a variable, then compare it in a switch statement, in order to write the required output to the text box.
Here is the code i am using
when execuiting this code i am being posted to default which prints the last name in the combo list.
Here is the code i am using
Code:
function EnterUserID()
{
var Name=document.MyForm.txtPerformedBy.value;
switch (Name)
{
case (Name="Keniemoka"):
document.MyForm.txtUserID.value="19";
break
case (Name="Caludech"):
document.MyForm.txtUserID.value="24";
break
case (Name="Harrichandrahp"):
document.MyForm.txtUserID.value="25";
break
case (Name="Adelah"):
document.MyForm.txtUserID.value="26";
break
case (Name="Francisff"):
document.MyForm.txtUserID.value="2";
break
case (Name="Christophercr"):
document.MyForm.txtUserID.value="11";
break
case (Name="msm"):
document.MyForm.txtUserID.value="12";
break
default:
document.MyForm.txtUserID.value=Name;
break
}
}
Comment