web前端之表单(八)------表单

1、最简单的表单
<!DOCTYPE html>
<html>
  <head>
    <title>biaodan1.html</title>

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--普通文本-->

  </head>

  <body>
    <form action="">
        username:<input type="text" name="username"><br>
        password:<input type="text" name="password">
    </form>
    <p><b>注意:</b>表单本身是不可见。并且注意一个文本字段的默认宽度是20个字符。</p>
  </body>
</html>

2、表单提交账号密码,密码不可见

<!DOCTYPE html>
<html>
  <head>
    <title>biaodan1.html</title>

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--普通文本-->

  </head>

  <body>
    <form action="">
        username:<input type="text" name="username"><br>
        password:<input type="password" name="password">
    </form>
    <p><b>注意:</b>表单本身是不可见。并且注意一个文本字段的默认宽度是20个字符。</p>
  </body>
</html>

3、单选框

<!DOCTYPE html>
<html>
  <head>
    <title>biaodan1.html</title>

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--单选框-->

  </head>

  <body>
    <form action="">
        <input type="radio" name="sex" value="male">Male<br>
        <input type="radio" name="sex" value="female">Female
    </form>
    <p><b>注意:</b>当用户点击一个单选按钮时,它就会被选中,其他同名的单选按钮就不会被选中。</p>
  </body>
</html>

4、多选框

<!DOCTYPE html>
<html>
  <head>
    <title>biaodan1.html</title>

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--多选框-->

  </head>

  <body>
    <form action="">
        <input type="checkbox" name="vehicle" value="bike">I have a bike<br>
        <input type="checkbox" name="vehicle" value="Car">I have a car
    </form>
    <p><b>注意:</b>可以多选</p>
  </body>
</html>

5、下拉框

<!DOCTYPE html>
<html>
  <head>
    <title>biaodan1.html</title>

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--下拉框-->

  </head>

  <body>
    <form action="">
    <select name="cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="fiat">Fiat</option>
    <option value="audi">Audi</option>
    </select>
    </form>
  </body>
</html>

6、下拉预选框

<!DOCTYPE html>
<html>
  <head>
    <title>biaodan1.html</title>

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--下拉框,预选框-->

  </head>

  <body>
    <form action="">
    <select name="cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="fiat" selected>Fiat</option>
    <option value="audi">Audi</option>
    </select>
    </form>
  </body>
</html>

7、文本框

<!DOCTYPE html>
<html>
  <head>
    <title>biaodan1.html</title>

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--文本域-->

  </head>

  <body>
    <textarea rows="10" cols="30">
         我是一个输入文本框
    </textarea>
  </body>
</html>

8、按钮

<!DOCTYPE html>
<html>
  <head>
    <title>biaodan1.html</title>

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--按钮-->

  </head>

  <body>
    <form action="">
        <input type="button" value="Hello world">
    </form>
  </body>
</html>

9、带边框的表单

<!DOCTYPE html>
<html>
  <head>
    <title>biaodan1.html</title>

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--带边框的表单-->

  </head>

  <body>
    <form action="">
    <fieldset>
        <legend>Personal information:</legend>
        Name:<input type="text" size="30"><br>
        E-mail:<input type="text" size="30"><br>
        Date of brith:<input type="text" size="10">
    </fieldset>
    </form>
  </body>
</html>

10、待提交的表单

<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<!--带边框的表单-->

</head>

<body>
    <form action="www.baidu.com">
        First name: <input type="text" name="FirstName" value="Mickey"><br>
        Last name: <input type="text" name="LastName" value="Mouse"><br>
        <input type="submit" value="提交">
    </form>
    <p>点击"提交"按钮,表单数据将被发送到服务器上的www.baidu.com</p>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值