当前位置:网站首页>《四》表单
《四》表单
2022-07-06 22:48:00 【花铛】
表单:用于显示、收集信息,并提交信息到服务器。
表单控件:包含在表单元素中具有可视化外观的 HTML 元素,用于访问者输入信息。包含
<input/>、<textarea></textarea>、<label></label>、<select></select>、<option></option>、<fieldset></fieldset>、<legend></legend>。
<form></form> 表单标签:
用来创建表单。
属性:
action:表单数据处理程序的 URL 地址。
method:表单数据提交的方式,属性值为 get 或 post(大小写都可以)。
get 方式提交时,会将表单的内容附加在 URL 地址后面,所以限制了提交的内容的长度,不超过 8192 个字符,且不具备保密性。
post 方式提交时,将表单中的数据一并包含在表单主体中,一起传送到服务器中处理,没有数据大小限制,具备保密性。enctype:表单数据进行编码的方式。
target:用来指定目标窗口。
name:表单名称。
<input> 输入框标签:
是单标记。
<input type="text"/> :
创建单行文本框。
属性:
- value:属性值。
- placeholder:提示文本。
- maxlength:输入框中最大允许输入的字符数。
- disabled:不可操作。
<input type="radio"/> :
创建单选框。一组单选框的 name 属性值必须相同。
属性:
- value:属性值。
- checked:被选中。
<input type="checkbox"/> :
创建多选框。一组多选框的 name 属性值必须相同。
属性:
- value:属性值。
- checked:被选中。
<input type="password"/> :
创建密码框。
<input type=”file”/>:
创建文件选择框,用于选择要上传的文件。
<input type=”hidden”/>:
创建隐藏域,在表达中包含不希望用户看到的信息。
<input type=”button”/>:
创建普通按钮,用于执行客户端脚本。
属性:
- value:按钮的文本。
<input type=”submit”/>:
创建提交按钮,传输表单数据给服务器端或其他处理程序。
属性:
- value:按钮的文本。
<input type=”reset”/>:
创建重置按钮,清空表单内容并把表单设置为最初的默认值。
属性:
- value:按钮的文本。
<select></select> 选项框标签:
<select></select> 表示下拉菜单,<option></option> 是它内部的选项。
<select></select> 的属性:
- size:大于 1 则为滚动列表,否则为下拉选项框
multiple='multiple':可多选。
<option></option> 的属性:
- value:选项的值。
- selected:被选中。
<select>
<option value=”1”>JAVA</option>
<option value=”1”>C++</option>
</select>
<textarea></textarea> 多行文本输入框标签:
创建多行文本输入框。
属性:
- cols:指定文本区域的列数。
- rows:指定文本区域的行数。
<label></label> :
将文本与控件进行绑定,单击文本就如同单击控件。
属性:
- for:表示与该元素相联系的控件的 ID 值。
// 在 HTML 4 中,是通过 label 标签的 for 属性和控件的 id 属性进行绑定的
<input type=”radio” id=”man”/>
<label for=”man">男</label>
// 在 HTML 5 中
<label>
<input type=”radio”> 男
</label>
<fieldset></fieldset> 和 <legend></legend>:
<fieldset></fieldset> 标签:为控件分组。<legend></legend> 标签:为分组指定一个标题。
<fieldset>
<legend>地址信息</legend>
地址:<input type=”text”/><br>
邮编:<input type=”text”/>
</fieldset>

边栏推荐
- Mysql database (basic)
- U++ 游戏类 学习笔记
- Pointer and array are input in function to realize reverse order output
- Meow, come, come: do you really know if, if else
- 九章云极DataCanvas公司获评36氪「最受投资人关注的硬核科技企业」
- Basic knowledge of road loss of 3GPP channel model
- Leetcode minimum difference in student scores
- A row of code r shows the table of Cox regression model
- 基于Bevy游戏引擎和FPGA的双人游戏
- Two divs are on the same line, and the two divs do not wrap "recommended collection"
猜你喜欢

Techniques d'utilisation de sublime

Why do many people misunderstand technical debt

Function pointer and pointer function in C language

如何设计 API 接口,实现统一格式返回?

3GPP信道模型路损基础知识

Programmers go to work fishing, so play high-end!

【愚公系列】2022年7月 Go教学课程 005-变量

九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!

Ansible中的inventory主机清单(预祝你我有数不尽的鲜花和浪漫)

In depth analysis of kubebuilder
随机推荐
Why is the salary of test and development so high?
为什么很多人对技术债务产生误解
Ansible概述和模块解释(你刚走过了今天,而扑面而来的却是昨天)
Oracle - views and sequences
Section 1: (3) logic chip process substrate selection
Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
最全常用高数公式
Factor analysis r practice (with R installation tutorial and code)
3.基金的类型
JS variable plus
Stm32f103ze+sht30 detection of ambient temperature and humidity (IIC simulation sequence)
[line segment tree practice] recent requests + area and retrieval - array modifiable + my schedule I / III
Why do many people misunderstand technical debt
Techniques d'utilisation de sublime
MySQL数据库(基础篇)
Leetcode minimum difference in student scores
NiO related knowledge points (I)
acwing 843. N-queen problem
File upload vulnerability summary
Tiktok may launch an independent grass planting community platform: will it become the second little red book