Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- javascript form element test


moonbiter - 5:24 pm on Jun 28, 2002 (gmt 0)


Here's a sample I think works ...

<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
function check(){
for (i=0;i<document.form.group1.length;i++){
if(document.form.group1[i].checked){
alert(document.form.group1[i].value);
}
}
}

</script>

</head>

<body>
<form name="form" action="">
<input type="radio" name="group1" value="1" />
<input type="radio" name="group1" value="2" />
<input type="radio" name="group1" value="3" />
<input type="radio" name="group1" value="4" />
<button onclick="check();">Click!</button>
</form>

</body>
</html>


Thread source:: http://www.webmasterworld.com/javascript/149.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com