zoukankan      html  css  js  c++  java
  • HTML5标签-单选框、复选框

    单选框:

    <input   type="radio/checkbox"   value="值"    name="名称"   checked="checked"/>

    1、type:

       当 type="radio" 时,控件为单选框

       当 type="checkbox" 时,控件为复选框

    2、value:提交数据到服务器的值(后台程序PHP使用)

    3、name:为控件命名,以备后台程序 ASP、PHP 使用

    4、checked:当设置 checked="checked" 时,该选项被默认选中

    单选示例代码:(其中name一定要一致,否则起不到单选的效果

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>单选框、复选框</title>
    </head>
    <body>
    <form action="save.php" method="post" >
    <label>性别:</label>
    <label>男</label>
    <input type="radio" value="1" name="gender" />
    <label>女</label>
    <input type="radio" value="2" name="gender" />
    </form>
    </body>
    </html>

    复选框示例:

    <html>

    <body>

    <form>
    我喜欢自行车:
    <input type="checkbox" name="Bike">
    <br />
    我喜欢汽车:
    <input type="checkbox" name="Car">
    </form>

    </body>
    </html>

  • 相关阅读:
    方法的重载
    构造方法
    方法与主方法
    类的一般形式
    多维数组
    如何使用数组
    数组的创建以及初始化
    流程控制之break、continue、return的用法
    流程控制之循环结构
    流程控制值选择结构
  • 原文地址:https://www.cnblogs.com/banchuangshuying/p/6211249.html
Copyright © 2011-2022 走看看