[javascript]取radiobuttonlist的value

  • 4016
  • 0

摘要:[javascript]取radiobuttonlist的value

var objSms = document.getElementById(idSms); //學期
var strSms = '' //學期
if (objSms != null) {
                for (var i = 0; i < objSms.rows[0].cells.length; i++) {
                    //alert(objSms[i].value);
                    if (objSms.rows[0].cells[i].childNodes[0].checked) {
                        strSms = objSms.rows[0].cells[i].childNodes[0].value;
                    }
                }
                if(strSms == ''){
                    item += "\n◎學期";
                }
            }
            alert(strSms);

這的RadioButtionList是Horizontal,如果Vertical:objSms.rows[0].cells[i]要改為obsSms.rows[i].cell[0]