 <p>Try to assign value like this ,</p> <pre><code> document.getElementsByName('ga')[0].value = ga; </code></pre> <p>where ga would be your sum , </p> <pre><code> ga = (pa+ma+oa).toFixed(2); </code></pre>