Click to See Complete Forum and Search --> : Auto Calculate Value


david2105
05-23-2003, 08:11 AM
Hey guys can anyone see the problem with this script below:

What happens is I have a row in a table with three input boxes: tInitialCost, tRate and tCost. A number is entered into the first box and an exchange rate into the second. When a button is clicked I want it to populate the third box with the value of the first box * the exchange rate, then hide the first button and show a submit button. I have placed a DIV tag around the third box with the ID CostRow.

For some reason when I click the button to call this sub it runs but nothing is outputted into the tCost box.

<script Language="vbscript">
Sub CostCalc()
vInCost = document.all("tInitialCost").value
vExRate = document.all("tRate").value
vCost = vInCost * vExRate
CostRow.innerhtml="<input type='text' name='tCost' value='" & vCost & "' size='5'>"

CalcButton.style.visibility = "hidden"
SubmitButton.style.visibility = "visible"

End Sub
</script>

Thanks,
David2105