单选按钮组 事件的实现
代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script type="text/javascript" language="javascript">
function checks()
{
var radios=document.getElementsByName("radio1");
for(var i=0;i<radios.length;i++)
{
if(radios[i].checked==true)
{
alert(radios[i].value);
}
}
}
</script>
</head>
<body>
<input name="radio1" type="radio" value="1" onClick="checks()">
<input name="radio1" type="radio" value="2" onClick="checks()">
</body>
</html>