1.html 5 d5fd7aea971a85678ba271703566ebfd formaction 属性
定义和用法formaction 属性规定当提交表单时,向何处发送表单数据。
注意内容:1.formaction 属性规定当表单提交时处理输入控件的文件的 url。
2.formaction 属性覆盖 ff9c23ada1bcecdd1a0fb5d5a0f18437 元素的 action 属性。
注释: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 <button> formmethod 属性
定义和用法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 <input> 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新增的属性 ,更多相关内勤请关注。
相关推荐:
jquery中dom操作——wrap
django 使用 request 获取浏览器发送的参数
react this绑定的几点思考
以上就是html5 form新增的属性的详细内容。