当我们在点击radio按钮的时候,通常会触发两次Selection事件,因为通常会有两个按钮的状态发生变化,一个按钮被选中,以前选中的按钮将不再被选中,会失去选中的状态,现在我想只对按钮被选中进行操作,应该怎么做?button中有没有类似isSelected判断是否被选中的方法?
------解决方案--------------------
刚刚没看清楚 LZ想做什么?RADIO应该是在FROM中吧获得RADIO的状态有何意义呢?
------解决方案--------------------
竟然这么大的缩进,重新发过
<html>
<head>
<script language= "javascript ">
function showSelect(){
for(var i=0; i < document.testForm.tRadio.length; i++){
if( document.testForm.tRadio[i].checked ){
alert(document.testForm.tRadio[i].value);
}
}
}
</script>
</head>
<body>
<form name= "testForm " id= "testForm ">
<input type= "radio " name= "tRadio " id= "r1 " value= "one " onclick= "showSelect() ">
<input type= "radio " name= "tRadio " id= "r2 " value= "two " onclick= "showSelect() ">
<input type= "radio " name= "tRadio " id= "r3 " value= "three " onclick= "showSelect() ">
</form>
</body>
</html>
------解决方案--------------------
还是没懂楼主的意思
不过感觉如果要那样做的话就不要用radio了