Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
This line is meaningless:
Code:
var the_values = document.getElementsByName("the_numbers").value;
Since you can't access the value attribute this way. getElementsByName creates an array of objects with "the_numbers" as a name attribute. Each of these objects will have attributes such as value attached to them, but to access them, you must loop over the array. So the above line becomes this:
Code:
var the_values = document.getElementsByName("the_numbers");
For another thing, the line my_selections=the_values[i] is probably not doing what you expect it to, since you defined my_selections as an array right above there. To add an element to the next item in an array, use the array's push method:
Code:
my_selections.push(the_values[i].value);
|