I need help in understanding how to transform this block into a simpler for loop:
var a,b,c;
a = parseInt(document.getElementById("a").value);
b = parseInt(document.getElementById("b").value);
c = parseInt(document.getElementById("c").value);
Is it possible to use a for loop to get all the values of from a form which can then be stored in an array?
arr = [];
for (var i = 0; i < 3; i++) {
var letter = parseInt(document.......value);
arr.push(letter);
} // end for
The form:
<form name="yourform">
<table>
<tr>
<td><label for="a">Enter first number:</label></td>
<td><input type="text" id="a" size="6"></td>
</tr>
<tr>
<td><label for="b">Enter second number:</label></td>
<td><input type="text" id="b" size="6"></td>
</tr>
<tr>
<td><label for="c">Enter third number:</label></td>
<td><input type="text" id="c" size="6"></td>
</tr>
<tr>
<td></td>
<td><button here onclick("functionhere") /></td>
</tr>
</table>
tablefor layout purposes. It is meant to be used only for displaying tabular data.