当前位置:网站首页>《四》表单
《四》表单
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>

边栏推荐
- Analyse approfondie de kubebuilder
- Techniques d'utilisation de sublime
- Gavin teacher's perception of transformer live class - rasa project actual combat e-commerce retail customer service intelligent business dialogue robot microservice code analysis and dialogue experim
- Detect when a tab bar item is pressed
- Read of shell internal value command
- Leetcode minimum difference in student scores
- Ansible中的inventory主机清单(预祝你我有数不尽的鲜花和浪漫)
- 最全常用高数公式
- Programmers go to work fishing, so play high-end!
- Meaning of 'n:m' and '1:n' in database design
猜你喜欢

Meow, come, come: do you really know if, if else

一文搞懂常见的网络I/O模型

Common Oracle SQL statements

Inventory host list in ansible (I wish you countless flowers and romance)

Ansible概述和模块解释(你刚走过了今天,而扑面而来的却是昨天)

Analyse approfondie de kubebuilder

Techniques d'utilisation de sublime

Why do many people misunderstand technical debt
![A detailed explanation of head pose estimation [collect good articles]](/img/22/7ae0b12c3d945b449bcc8bb4a8961b.jpg)
A detailed explanation of head pose estimation [collect good articles]

Chapter 9 Yunji datacanvas company has been ranked top 3 in China's machine learning platform market
随机推荐
Ansible中的inventory主机清单(预祝你我有数不尽的鲜花和浪漫)
Flask project uses flask socketio exception: typeerror: function() argument 1 must be code, not str
九章云极DataCanvas公司获评36氪「最受投资人关注的硬核科技企业」
最全常用高数公式
如何设计 API 接口,实现统一格式返回?
sscanf,sscanf_ S and its related usage "suggested collection"
LabVIEW在打开一个新的引用,提示内存已满
Run the command once per second in Bash- Run command every second in Bash?
Why do many people misunderstand technical debt
第一篇论文的写作流程
Function pointer and pointer function in C language
【Android Kotlin协程】利用CoroutineContext实现网络请求失败后重试逻辑
【二叉树】二叉树寻路
关于01背包个人的一些理解
File upload vulnerability summary
How does vscade use the built-in browser?
Can I specify a path in an attribute to map a property in my class to a child property in my JSON?
3GPP信道模型路损基础知识
What work items do programmers hate most in their daily work?
Windows are not cheap things