首页 > 代码库 > Html表单

Html表单

<html>
  <head>
    <meta charset="utf-8">
    <title>first web</title>
  </head>

  <body>
    #form:表单提交的的模块
    # action提交到服务器的地址   method: get(显示传输地址) post(影藏传输地址)
    <form class="" action="https://www.sogou.com/web" method="post" enctype="multipart/form-data">
      #type:text(文本输入)
      <input type="text" name="query" value="">

      #radio单选框
      <p>男<input type="radio" name="gender" value="http://www.mamicode.com/Male"></p>
      <p>女<input type="radio" name="gender" value="http://www.mamicode.com/Female"></p>

      #checkbox 复选框,可以选择多个
      <p>篮球<input type="checkbox" name="hobby" value="http://www.mamicode.com/basketball"></p>
      <p>羽毛球<input type="checkbox" name="hobby" value="http://www.mamicode.com/badminton"></p>
      <p>足球<input type="checkbox" name="hobby" value="http://www.mamicode.com/football"></p>

      #file 文件提交  必须声明一个enctype属性,告诉服务器,是分段发
      <p><input type="file" name="" value=""></p>

      #下拉框  multiple(多选) size(显示几个)
      <select class="" name="region" multiple="multiple" size="2">
        <optgroup label="金马">
          <option value="">1楼</option>
          <option value="">2楼</option>
          <option value="">3楼</option>
          <option value="">4楼</option>
        </optgroup>
      </select>

      #文本备注 可以做备注 评价用
      <p><textarea name="name" rows="8" cols="80">dfa</textarea></p>


      <label for="rrr">123</label>
      <input id="rrr" type="text" >

      <fieldset>
        <legend>登录</legend>
        <input type="text" name="" value="">
      </fieldset>

      #button 按钮
      <p>1<input type="button" name="" value="http://www.mamicode.com/d"></p>

      #type:submit(向服务器提交内容)
      <input type="submit" name="" value="http://www.mamicode.com/提交">
    </form>
  </body>
</html>

 

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>first web</title>
  </head>

  <body>
    <form class="" action="" method="post">
      <p>用户名<input type="text" name="query" value=""></p>
      <p>密码:<input type="password" name="pwd" value=""></p>

      <p>男<input type="radio" name="gender" value="http://www.mamicode.com/Male"></p>
      <p>女<input type="radio" name="gender" value="http://www.mamicode.com/Female"></p>

      <p>篮球<input type="checkbox" name="hobby" value="http://www.mamicode.com/basketball"></p>
      <p>羽毛球<input type="checkbox" name="hobby" value="http://www.mamicode.com/badminton"></p>
      <p>足球<input type="checkbox" name="hobby" value="http://www.mamicode.com/football"></p>

      <select class="" name="region">
        <option value="">湖南</option>
        <option value="">长沙</option>
        <option value="">株洲</option>
        <option value="">攸县</option>
        <option value="">市坪</option>
      </select>

      <label for="rrr">123</label>
      <input id="rrr" type="text" >

      <fieldset>
        <legend>登录</legend>
        <input type="text" name="" value="">
      </fieldset>

      <p><textarea name="name" rows="1" cols="20"></textarea></p>

      <p><input type="file" name="" value=""></p>

      <p><input type="button" name="" value="http://www.mamicode.com/按钮"></p>

      <p><input type="submit" name="" value="http://www.mamicode.com/提交"></p>
    </form>
  </body>
</html>

  

 

Html表单