-
RADIO buttons undefined
i have the scenario
<form name="monkey">
<input type="radio" name="number" value="1">1<br>
<input type="radio" name="number" value="2">2<br>
</form>
and the jscript:
function whatever()
{
var a = monkey.number.value;
alert(a);
}
and the alert says undefined.
does anyone know why?
Richard
-
Monkey in a muddle
Yep
You have two tags called Monkey - in order to reference one of the items you must virst loop through the collection of all tags called Monkey - this is how I do it:-
var collection = document.all["Monkey"];
for (var i=0;i<collection.length;i++)
alert(collection[i].value);