Hello.
Can anyone tell me why in this simple code my variable “the_values” is showing undefined in Firebug? or better yet..why it’s not doing anything…
[CODE]
<html><head><title>Whatever</title>
<script type=”text/javascript”>
function attachHandlers(){
var the_button = document.getElementById(“the_click”);
the_button.onclick=showPicks();
}
function showPicks(){
var the_values = document.getElementsByName(“the_numbers”).value;
var my_selections = new Array();
for (var i=0; i<the_values.length; i++){
my_selections= the_values[i];
}
alert(my_selections);
}
</script></head>
<body onload=”attachHandlers()”>
<form>
<input type=”textbox” name=”the_numbers” size=”1″ value=”1″>
<input type=”textbox” name=”the_numbers” size=”1″ value=”2″>
<input type=”textbox” name=”the_numbers” size=”1″ value=”3″>
<input type=”textbox” name=”the_numbers” size=”1″ value=”4″><br>
<input type=”button” value=”checknumbers” size=”1″ id=”the_click”>
</form>
</body>
</html>