A Tiny Trick
...
  <form name="sample">
    Give a number
    <input type="text" name="x1" size=3
   onChange=" x2.value = (x1.value*1)+2 " >
    Adding 2 to it
    <input type="text" name="x2" size=3>
  </form>
...