line from the form -

<input type="text" name="stroka"> 

and in the script you need the values ​​of the string put in an array. then calculate the sum of the Numbers of the line How do you advise to implement?

 var arr = []; for(var i=0,j=obj.stroka.(length-1);i<j;i++) { arr[i]=obj.stroka.value.charAt[i]; } 

    1 answer 1

     var strk = document.getElementById("my-input").value, sum =0; for(var i=0, max = strk.length;i<max;i++) if(!isNaN(strk.charAt(i))) sum += 1*strk.charAt(i); alert(sum); 

    This code will count the sum of only one-character digits included in the string entered in the input with id = "my-input"