js 判断单选按钮是否被选中

<script language="javascript">
function chaxun(){
 var weighttime = document.getElementsByName("weighttime");
 for(var i=0;i<weighttime.length;i++){
   if(weighttime[0].checked == true){
    weight = weighttime[0].value; 
    alert(weight);
   }
 }
}
</script>
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页