function amt_check(form,field_name,amount)
{
.
.
some code to calculate newamt
.
.
if (field_name == "cost"
{
form.cost.innerText = newamt;
} else if (field_name == "unit_price"
{
form.unit_price.innerText = newamt;
} else if (field_name == "total_cost"
{
form.total_cost.innerText = newamt;
} else if ......
}
Is there a way to substitute the "field_name" in the assignment statements so that the above if/else statements would look like
form.??field_name??.innerText = newamt;
Your help would be appreciated.
Thanks.
Dove85