var a= 12;
var b= this.getField("c1");
var c= this.getField("c2");
c.value= a.value - b.value;
You need to make sure b.value is a number and not a string displaying a number.
var a = 12;
var b = this.getField("c1").value;
this.getField("c2").value = a - b;
If you want to force b to be a number instead of a string:
var b = Number(this.getField("c1").value);
It worked perfectly, thanks!