I know that this has probably been beaten to death, but I just don't understand why this won't work. Can someone tell me what I'm doing wrong?
I would really just like to get the value of the button that is checked (or see how many elements are on the page, but I keep getting that the element isn't an object.
Thanks in advance,
J
I would really just like to get the value of the button that is checked (or see how many elements are on the page, but I keep getting that the element isn't an object.
Code:
<html>
<head>
<script language="javascript">
function ShowMe() {
var a;
for (i=0;i<document.forms[0].radBtnPictures.length;i++) {
a++;
}
alert(a)
}
</script>
</head>
<body>
<input id="ratBtnSome" type="radio" name="radBtnPictures" value="radBtnSome" /><label for="radBtnNone">Some</label>
<input id="radBtnNone" type="radio" name="radBtnPictures" value="radBtnNone" checked="checked" /><label for="radBtnNone">None</label>
<input type="button" value="Click Me" onclick="ShowMe()" />
</body>
</html>
Thanks in advance,
J