js获取单选按钮的值 function getVals(){ var res = getRadioRes('rds'); if(res == null){mui.toast('请选择'); return;} mui.toast(res); } function getRadioRes(className){ var rdsObj = document.getElementsByClassName(className); var checkVal = null; for(i = 0; i < rd
C# 为 form 窗体中的所有相同组件循环添加相同事件,这样减少了代码量. private void Form2_Load(object sender, EventArgs e) { foreach (Control c in groupBox1.Controls)//遍历groupBox1内的所有控件 { if (c is CheckBox)//只遍历CheckBox控件 { ((CheckBox)c).CheckStateChanged += new EventHandler(chk_Ch