表单

为什么要使用表单?

    用于向服务器传数据

1. 表单类型

  (1)text ——单行文本输入框

  (2)password ——密码框

  (3)radio ——单选框

  (4)checkbox ——复选框

  (5)select ——下拉列表

  (6)reset ——重置按钮

  (7)submit ——提交按钮

  (8)textarea ——多行文本框

 2.表单及表单的两个必须要填的重要的属性

     <form action="http://www.baidu.com" method="get">      //action表示你要将里面的数据提交到服务器的路径,

        用户名:<input type="text" name="txtName"/><br/>    method表示提交这些数据要使用的形式

        密码:<input type="password" name="txtPwd"/><br/>

        <input type="radio" name="sex"/>男        //还可将性别包含在<fieldset><legend>性别</legend>……</fieldset>之间

        <input type="radio" name="sex"/>女<br/>

         <input type="submit" value="提交到百度"/>    //value表示要显示的文字

        <input type="reset" value="清空"/><br>

     </form>

3. 下拉列表

    <select size="1">        //size表示显示几个选项  <select>

      <option>河南省</option>                <optgroup label="河南省">

      <option>河北省</option>                  <option>郑州</option>

      <option>辽宁省</option>                  <option>洛阳</option>

      <option>广东省</option>                </optgroup>

    </select>                          <optgroup>……</optgroup></select>

4. 上传照片(文件)

    <input type="file"/>

原文地址:https://www.cnblogs.com/zhangchaoran/p/6799378.html