New attributes of HTML5 form
1.HTML 5 formaction attribute
Definition and usage
The formaction attribute specifies where to go when submitting a form. Send form data.
Note:
1. The formaction attribute specifies the URL of the file that handles the input control when the form is submitted.
2. The formaction attribute overrides the action attribute of the
Note: The formaction attribute applies to type="submit" and type="image".
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>formaction</title> </head> <body> <form id="testform"> <input type="submit" name="s1" value="v1" formaction="http://localhost:8080/index01/Test01.jsp">提交到http://localhost:8080/index01/Test01.jsp <input type="submit" name="s2" value="v2" formaction="http://localhost:8080/index01/Test02.jsp">提交到http://localhost:8080/index01/Test02.jsp <input type="submit" name="s3" value="v3" formaction="http://localhost:8080/index01/Test03.jsp">提交到http://localhost:8080/index01/Test03.jsp </form> </body> </html>
2.HTML 5
定义和用法
formmethod 属性覆盖 form 元素的 method 属性。
可以通过以下方式发送 form-data :
以 URL 变量 (使用 method="get") 的形式来发送
以 HTTP post (使用 method="post") 的形式来发送
该属性与 type="submit" 配合使用。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form id="testform"> <input type="submit" name="s1" value="v1" formmethod="post" formaction="http://localhost:8080/index01/Test01.jsp">http://localhost:8080/index01/Test01.jsp <input type="submit" name="s2" value="v2" formmethod="get" formaction="http://localhost:8080/index01/Test02.jsp">http://localhost:8080/index01/Test02.jsp <input type="submit" name="s1" value="v1" formmethod="post" formaction="http://localhost:8080/index01/Test03.jsp">http://localhost:8080/index01/Test03.jsp </form> </body> </html>
和
<!DOCTYPE HTML> <html> <body> <form action="/example/html5/demo_form.asp" method="get"> 姓:<input type="text" name="lname" /><br /> 名:<input type="text" name="fname" /><br /> <button type="submit" >提交</button> <button type="submit" formmethod="post" formaction="/example/html5/demo_post.asp">使用 POST 来提交</button> </form> </body> </html>
3HTML 5 autofocus 属性
定义和用法
autofocus 属性规定当页面加载时 input 元素应该自动获得焦点。
如果使用该属性,则 input 元素会获得焦点。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form> <input type="text"> <input type="text" autofocus> </form> </body> </html>
本文讲解了HTML5 form新增的属性 ,更多相关内勤请关注php中文网。
相关推荐:
The above is the detailed content of New attributes of HTML5 form. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
