hanwater

JS获取单选与多选按纽的值

//求单选按纽的值,适用单选项及多选项。未选返回false;有选择项,返回选项值。
function CheckRadio(theRadio){
    var theRadioLen = theRadio.length;
    var theRadioValue = false;
    if (theRadioLen == undefined){
        if (theRadio.checked){
            theRadioValue = theRadio.value;
        }
    }else{
       
  for (theRadioI=0;theRadioI<theRadioLen;theRadioI++){
            if (theRadio[theRadioI].checked){
                theRadioValue = theRadio[theRadioI].value;
                break;
            }
        }
    }
    return theRadioValue;
}

theRadio这个取值:表单名.元素名称

分类:

技术点:

相关文章:

  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
猜你喜欢
  • 2021-09-22
  • 2021-05-21
  • 2021-11-26
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案