表单标签form
表单标签:form
属性:
action:提交到地址url
method:提交方式
1)get方式
2)post方式
input标签中必填的属性:
name属性:给后台标记当前input标签中的内容
get方式和post方式的区别:
get方式
1)将用户的信息提交到地址栏了,不安全
地址栏:http://xxxxx?username=zhangsan&pwd=123456
2)提交的数据大小有限制,不超过4KB
post方式
1)不会将用户的信息提交到地址栏: 在浏览器header
实体内容:username: zhangsan pwd:123456(后期:密码加密)
2)使用post方式居多,用来上传文件,提交的数据大小无限制
方法用例
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>表单标签1</title>
</head>
<body>
<!--表单标签:form-->
<form action="#" method="get">
用户名:<input type="text" name="username" /><br />
密 码:<input type ="password" name="pwd" />
<br />
<input type="submit" value="注册" />
</form>
<br /><hr /><br />
<form action="#" mothod="post">
用户名:<input type="text" name="username" placeholder="请输入用户名" /> <br />
密 码:<input type="password" name="password" placeholder="请输入密码" />
<br />
<input type="submit" value="注册" />
</form>
</body>
</html>
结果展示
使用get方式的地址栏:
使用post方式的地址栏:
程序结果:
表单项
表单项:
其他属性:
h5的属性:placeholder:当前input中的默认值
input type = “test” :文本输入框
input type = “password” :密码输入框
input type = “redio” :单选按钮
input type = “checkbox” :复选框
select :下拉菜单
option :下拉选项
input type = “file” : 上传文件
input type = “date” :当前年月日时 间
input type = “date-local” :当前年月日--:--
input type ="number" :举例:电话号码:这里面只能书写数字
textarea :文本域
属性:
rows :指定文本域的行数
cols:指定当前每一行能写多少个字符
input type="hidden" 隐藏域(没有任何效果显示,可以传递数据)
按钮
input type ="submit" 提交
input type ="button" 普通按钮,必须指定默认值
input type ="reset" 重置按钮
方法用例
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>表单标签</title>
</head>
<body>
<h2>学生个人信息填写</h2>
<form action="#" method="post"</