HTML5 form新增的屬性
1.HTML 5 formaction 屬性
#定義與用法
formaction 屬性規定當提交表單時,向何處發送表單資料。
注意內容:
1.formaction 屬性規定當表單提交時處理輸入控制項的檔案的 URL。
2.formaction 屬性覆寫
註解:formaction 屬性適用於 type="submit" 和 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中文网。
相关推荐:
以上是HTML5 form新增的屬性的詳細內容。更多資訊請關注PHP中文網其他相關文章!
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章
如何修復KB5055523無法在Windows 11中安裝?
3 週前
By DDD
如何修復KB5055518無法在Windows 10中安裝?
3 週前
By DDD
<🎜>:死鐵路 - 如何馴服狼
4 週前
By DDD
R.E.P.O.的每個敵人和怪物的力量水平
4 週前
By 尊渡假赌尊渡假赌尊渡假赌
<🎜>:種植花園 - 完整的突變指南
2 週前
By DDD

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)