• 微信号
目录

html笔记

您当前的位置:首页 > 我的笔记 > html笔记>html表单属性

html表单属性

Action 属性

action 属性定义提交表单时要执行的操作

通常,当用户单击“提交”按钮时,表单数据将发送到服务器上的文件中.

<form action="index.php"></form>

Target 属性

target 属性规定提交表单后在何处显示响应

target 属性可设置以下值之一

描述
_blank 响应显示在新窗口或选项卡中。
_self (默认值)响应显示在当前窗口中。
_parent 响应显示在父框架中。
_top 响应显示在窗口的整个 body 中。
framename 响应显示在命名的 iframe 中。
<form action="index.php" target="_blank"></form>

Method 属性

method 属性指定提交表单数据时要使用的 HTTP 方法

表单数据可以作为 URL 变量(使用 method="get")或作为 HTTP post 事务(使用 method="post")发送

提交表单数据时,默认的 HTTP 方法是 GET

<form action="index.php" method="post"></form>

Autocomplete 属性

autocomplete 属性规定表单是否应打开自动完成功能

启用自动完成功能后,浏览器会根据用户之前输入的值自动填写值

<form action="index.php" autocomplete="on"></form>

Novalidate 属性

novalidate 属性是一个布尔属性

如果已设置,它规定提交时不应验证表单数据

<form action="index.php" novalidate></form>

所有form属性列表

属性 描述
accept-charset 规定用于表单提交的字符编码。
action 规定提交表单时将表单数据发送到何处。
autocomplete 规定表单是否应打开自动完成(填写)功能。
enctype 规定将表单数据提交到服务器时应如何编码(仅供 method="post")。
method 规定发送表单数据时要使用的 HTTP 方法。
name 规定表单名称。
novalidate 规定提交时不应验证表单。
rel 规定链接资源和当前文档之间的关系。
target 规定提交表单后在何处显示接收到的响应。