如何在html5中验证组复选框?

时间:2015-02-13 10:23:18

标签: html5

如何验证html5中的组复选框?因为对于每个我需要的复选框,如果我想将复选框分组以进行验证,我们该怎么办? 到目前为止,我已经完成了我的代码。任何人都可以指导我,因为我计划在每个人经常更新浏览器时使用html5验证。 我的问题是?

  1. 我不想在复选框中给出每个字段吗?我想知道我想用哪个属性来分组html5中的复选框验证?
  2. 单独进行html5验证是否足够?
  3. 它会支持所有浏览器吗?
  4. <form name="vk" action="" method="post"/>
            Name:<input type="name" name="username" value="" required/><br/><br/>
            password:<input type="password" name="password" value="" required/><br/><br/>
            Please select subject:
            <input type="checkbox" name="subject[]" id="all" value="all" required>All Subject
            <input type="checkbox" name="subject[]"  value="science" required>Science
            <input type="checkbox" name="subject[]"  value="maths">Maths<br/><br/><br/>
    
            Please select Subject for class twelve<br/>
    
            <input type="checkbox" name="classfivesubject[]" id="mat" value="BScTuition (Physics)">BScTuition (Physics)<br/>
            <input type="checkbox" name="classfivesubject[]" id="mat" value="BSc Tuition (Chemistry)">BSc Tuition (Chemistry)<br/>
            <input type="checkbox" name="classfivesubject[]" id="mat" value="BCA Tuition (Computer)">BCA Tuition (Computer)<br/>
            <input type="checkbox" name="classfivesubject[]" id="mat" value="BCA Tuition (IT)">BCA Tuition (IT)<br/>
            <input type="checkbox" name="classfivesubject[]" id="mat" value="BSc Tuition (Biology)">BSc Tuition (Biology)<br/>
            <input type="checkbox" name="classfivesubject[]" id="mat" value="BSc Tuition (MicroBiology)">BSc Tuition (MicroBiology)<br/>
            <input type="checkbox" name="BSc Tuition (MicroBiology)" id="mat" value="BSc Tuition (MicroBiology)">BSc Tuition (MicroBiology)
            <input type="checkbox" name="BSc Tuition (Zoology)" id="mat" value="BSc Tuition (Zoology)">BSc Tuition (MicroBiology)<br/>
            <input type="submit" name="submit" value="Submit"/>
            </form>
    

0 个答案:

没有答案