TextBox Values Added

[Total: 0    Average: 0/5]

This example will sum up integer values in text boxes.

Body Code:

function soma(){ 
var vtemp=0 
for (var i=1;i<5;i++){ // loop to get all inputs 
if(!isNaN(vtemp)) vresult+=vtemp // if value is a number - add it. 
document.all.result.value=vresult // change the last input...Result one 
<input name=box1 onchange="soma()"> 
<input name=box2 onchange="soma()"> 
<input name=box3 onblur="soma()"> 
<input name=box4 onblur="soma()"><br> 
SUM:<input name=result > 

Times Viewed: 9

Leave a Reply

Your email address will not be published. Required fields are marked *