function calculate_price (formName, fieldName0, fieldName1, fieldName2, fieldName3, fieldName4) { var doc = 'document.'; var input0 = parseFloat (fieldName0); var input1 = Trim (eval (doc + formName + "." + fieldName1 + ". value")); var input2 = Trim (eval (doc + formName + "." + fieldName2 + ". value")); var input3 = Trim (eval (doc + formName + "." + fieldName3 + ". value")); var input4 = Trim (eval (doc + formName + "." + fieldName4 + ". value")); if (input1 == '') { var tot_price = 0; } else { var tot_price = parseFloat (input0) * parseInt (input1); } var net_price = tot_price + parseInt (input3); eval (doc + formName + "." + fieldName2) .value = tot_price; eval (doc + formName + "." + fieldName4) .value = net_price; }
And fieldName2 and fieldName4 are text boxes with such funny attributes: style = "background: none; border: hidden; color: #FFFFFF; font-weight: bolder; "readonly