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

2012-11-12

  //求单选按纽的值,适用单选项及多选项。未选返回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

  if (theRadio[theRadioI].checked){

  theRadioValue = theRadio[theRadioI].value;

  break;

  }

  }

  }

  return theRadioValue;

  }

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

分享到:
0
相关阅读
友情链接
© 2018 我考网 http://www.woexam.com 中国互联网举报中心 湘ICP备18023104号 京公网安备 11010802020116号
违法和不良信息举报:9447029@qq.com