garrisonian14
05-29-2009, 11:50 AM
I want to pass name of form field to a JavaScript function and get its value
like
function getValue(fldName)
{
sel_val = document.mcqReport.fldName.value;
}
Here mcqReport is formname
and i call this function like
getValue("txtUserName");
getValue("txtUseEmail");
txtUserName and txtUseEmail are two input fields of my form. But it gives error
Error: document.mcqReport.fldName is undefined
Please can you help me how i can do this.
Thanks
like
function getValue(fldName)
{
sel_val = document.mcqReport.fldName.value;
}
Here mcqReport is formname
and i call this function like
getValue("txtUserName");
getValue("txtUseEmail");
txtUserName and txtUseEmail are two input fields of my form. But it gives error
Error: document.mcqReport.fldName is undefined
Please can you help me how i can do this.
Thanks