zoukankan      html  css  js  c++  java
  • html checkbox

    <fieldset>
    <legend>where do you live?</legend>
    <input type="checkbox" id="arearural" name="areatypes[]" value="rural"/>
    <label for="arearural">Rural </label>
    <input type="checkbox" id="areasuburb" name="areatype[]" value="suburb"/>
    <label for="areasuburb">Suburb</label>
    <input type="checkbox" id="areacity" name="areatypes[]" value="city"/>
    <label for="areacity">City </label>
    </fieldset>

       Here the name attribute for all the checkmarks is the same and has square brackets prefi xed to it.The square brackets tell the system to send the checked values as an array. If you leave off the square   brackets, only the last checked value is sent. You could also have each name be different and without   the square brackets. In that case each name that was selected is sent as a separate value. With checkboxes,  only checked values are sent.

    name数组以数组的形式发送选择的值,如果省略方括号,仅仅只有最后一个选择的值被发送。

    You can also have individual checkboxes that are not part of a group. In the following instance,

    if the box is checked, the form fi eld imagesonly is sent with the value of yes. If it is not checked,
    nothing is sent:
    <input type=”checkbox” id=”imagesonly” name=”imagesonly” value=”yes” />
    <label for=”imagesonly”> Check here if you only want images.</label>

  • 相关阅读:
    Codeforces Round #541 (Div. 2) D 并查集 + 拓扑排序
    Educational Codeforces Round 60 D dp + 矩阵快速幂
    Educational Codeforces Round 60 C 思维 + 二分
    Codeforces Round #544 (Div. 3) dp + 双指针
    Codeforces Round #542(Div. 2) CDE 思维场
    UVA
    UVA
    UVA
    UVA
    UVA
  • 原文地址:https://www.cnblogs.com/youxin/p/2329422.html
Copyright © 2011-2022 走看看