我的复选框提交有问题。我知道当我们要提交多值复选框时,我们必须在里面输入名称,例如:ccd_pos[]。但现在它不起作用,因为我有一个 javascript 验证,在选中复选框 1 后启用了复选框 2、3、4 的功能。您可以在下面看到我的代码:
Javascript代码
if (theForm.ccd_chk.checked)
{
theForm.ccd_pos [0].className = 'part';
theForm.ccd_pos [1].className = 'part';
theForm.ccd_pos [2].className = 'part';
theForm.ccd_pos [0].disabled = false;
theForm.ccd_pos [0].checked = false;
theForm.ccd_pos [1].disabled = false;
theForm.ccd_pos [1].checked = false;
theForm.ccd_pos [2].disabled = false;
theForm.ccd_pos [2].checked = false;
}
else
{
theForm.ccd_pos [0].disabled = true;
theForm.ccd_pos [1].disabled = true;
theForm.ccd_pos [2].disabled = true;
}
HTML 复选框
<input type="checkbox" name="ccd_chk" value="yes" class="part" onclick="ActionCcdCheck (this.form);" onkeypress="FocusChange (this.form, 5, 4);"/>
<input type="checkbox" name="ccd_pos" value="front" class="part" onkeypress="FocusChange (this.form, 6, 3);"/> Front
<input type="checkbox" name="ccd_pos" value="back" class="part" onkeypress="FocusChange (this.form, 7, 2);"/> Back
<input type="checkbox" name="ccd_pos" value="fb" class="part" onkeypress="FocusChange (this.form, 8, 1);"/> FB
所以现在我的问题是如何使复选框保持功能和复选框的值在我提交时可以结合起来。
谢谢。