|
-
Aug 2nd, 2001, 05:23 AM
#1
Thread Starter
New Member
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
-
Aug 2nd, 2001, 09:26 AM
#2
New Member
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);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|