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>

  • 相关阅读:
    【POJ】3243 Clever Y
    【BZOJ】3916: [Baltic2014]friends
    【URAL】1960. Palindromes and Super Abilities
    【BZOJ】3621: 我想那还真是令人高兴啊
    【BZOJ】2286: [Sdoi2011消耗战
    【POJ】2891 Strange Way to Express Integers
    鬼畜的多项式
    【CF】438E. The Child and Binary Tree
    【BZOJ】3456: 城市规划
    【POJ】1811 Prime Test
  • 原文地址:https://www.cnblogs.com/youxin/p/2329422.html
Copyright © 2011-2022 走看看