I'm doing a HTML web that accept numbers separated by "," and then get the sum of all. I have tried this code, but don't work.
<!DOCTYPE html>
<html>
<body>
<p>Input the numbers you want separated by ","</p>
<input id="num"></input>
<button onclick="sumAll1()">click!</button>
<p id="total"></p>
<script>
function sumAll1(){
document.getElementById("total").innerHTML = sumAll(document.getElementById("num").innerHTML.value);
}
function sumAll() {
var i, sum = 0;
for(i = 0; i < arguments.length; i++) {
sum += arguments[i];
}
return sum;
}
</script>
</body>
</html>
<input id="num"></input>should be<input type="text" id="num"/>