I have a form that updates a total based on the fields values entered on a form when the user leaves each field.
This works fine but I also want to update one of the entry fields which is a percentage of another.
I have in my js
var theForm = document.forms[frm];
var eTotal = theForm.elements["Total"];
var ePremium = theForm.elements["Premium"];
if (eTotal.value > 0) {
var PremAmount = parseFloat(eTotal.value * ePremium.value / 100);
}
var divobj = document.getElementById('PremAmount');
divobj.innerHTML = PremAmount.toFixed(2);
Which is called with
onblur="addPrem('totals')"
The original value in the totals field from the MySQL table is 770.00
This produces the following html page
<input name="PremAmount" tabindex="1" class="ent" id="PremAmount" size="2" value="77.00">
When I change the total to 888.00 I get the following
<input name="PremAmount" tabindex="1" class="ent" id="PremAmount" size="2" value="77.00">88.80</input>
So it looks like it's working but writing a div rather than into the field itself
Can anyone help me with this please