Html5 表单语法,按钮和多选框,

表单语法

<form method="post" action="result.html">
    <p>名字:<input name="name" type="text"></p>
    <p>密码:<input name="pass" type="password"></p>
    <p>
        <input type="submit" name="Button" value="提交"/>
         <input type="submit" name="Reset" value="重填"/>
    </p>
</form>

规定如何发送表单数据常用值:get | post

表示向何处放送表单数据 :action="result.html

表单的基本语句

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆注册</title>
</head>
<body>
<h1>注册</h1>


<!--表单form
acction :表单提交的位置,可以是网站,也可以是个请求地址
method:post,get 提交方式
      get方式提交:我们可以在url中看到我们提交的信息,不安全,高效
      post:比较安全,可以传输大文件
-->

<form action="我的网页.html" method="get">
<!--文本输入框:input type="text"-->
<p>名字:<input type="text" name="username"/> </p>
<!--密码框:input type="password="-->
<p>密码:<input type="password" name="pwd"></p>
<p>
    <input type="submit">
    <input type="reset">
</p>
</form>
</body>
</html>

表单元素格式

type:指定元素的类型。text,password,checkbox,radio,submit,reset,flie,hidden,image和button,默认为text。

name:指定表单元素的名称

value:元素的初始值。type为radio时必须指定一个值

size:指定表单元素的初始宽度。当type为text或password时,表单元素的大小以字符为单位。对于其他类型,宽度以像素为单位

maxlength:type为text或者password时,输入的最大字符数

checke:type为radio或checkbox时,指定按钮是否是被选中

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆注册</title>
</head>
<body>
<h1>注册</h1>


<!--表单form
acction :表单提交的位置,可以是网站,也可以是个请求地址
method:post,get 提交方式
-->

<form action="我的网页.html" method="get">
<!--文本输入框:input type="text"
 value="张鑫"  默认的初始值
 maxlength="8" 最长能写几个字符
  size="30"    文本框的长度
  -->
<p>
    名字:<input type="text" name="username"/>
</p>
<!--密码框:input type="password="-->
<p>
    密码:<input type="password" name="pwd">
</p>
    <!--单选框标签:
    input type="radio"
    value:单选框的值
    name:表示组数(如果组数相同就能选一个,组数不同就能全选)
     -->
    <p>性别:
       <input type="radio" value="boy" name="sex"/><input type="radio" value="girl" name="sex"></p>
<p>
    <input type="submit">
    <input type="reset">
</p>
</form>
</body>
</html>

按钮和多选框

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆注册</title>
</head>
<body>
<h1>注册</h1
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值