Hi all,
I have two textfields - fieldA and fieldB.
Once fieldB has lost focus (onBlur()) I want the following calculation to be made...
((fieldA-field😎/field😎 *100
the result should then be formatted to two decimal places
and I want to return this result to another field - fieldC.
Any ideas on how this is done? Thanks.
My code so far...
function calculate()
{
var fieldA = document.getElementById("fieldA");
var fieldB = document.getElementById("fieldB");
var calc = ((fieldA-fieldB)/fieldB) * 100;
return calc;
}
textfield:
<input type="text" name="field2" id="field2" onblur="change()" />
Field to contain returned value...
<textarea name="fieldC" id="fieldC"><script>var calc;</script></textarea>