问题描述
大家好。
我有这个简单的表格。
我需要选中复选框C_1:
1)字段名称=" n_1"是必填项并且仅接受数字;
2)字段名称=" n_2"是必填项并且仅接受数字;
如果选中复选框C_2,我需要:
3)字段名称=" n_3"是必填项并且仅接受数字;
4)字段名称=" n_4"是必需的,只接受数字;
如果没有选中复选框,则不需要任何字段。
你能帮助我吗?
Hi all.
I have this simple form.
I need if checkbox C_1 is selected:
1) field name="n_1" is required and accept only numbers;
2) field name="n_2" is required and accept only numbers;
I need if checkbox C_2 is selected:
3) field name="n_3" is required and accept only numbers;
4) field name="n_4" is required and accept only numbers;
If checkbox not selected no required fields.
Can you help me?
推荐答案
mmm对不起但是我不明白...... 。
mmm sorry but I dont understand....
你不懂什么?复选框的东西?每个checkbox元素都有一个名为''checked''的属性。您可以测试此属性是真还是假,具体取决于您可以进行验证。
问候
what don''t you understand? the checkbox thing? well every checkbox element has a property called ''checked''. you can test if this property is true or false and depending on that you can do the validation.
regards
这篇关于[Javascript]如果选中复选框C_1,则需要字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!