value.onload = function calc2(form) { a = form.c.value; b = form.d.value; c = a-b; k = c/a; d = k*100; form.total2.value = d; }