本文摘自PHP中文网,作者jacklove,侵删。
1.HTML 5 <input> formaction 属性定义和用法
formaction 属性规定当提交表单时,向何处发送表单数据。
注意内容:
1.formaction 属性规定当表单提交时处理输入控件的文件的 URL。
2.formaction 属性覆盖 <form> 元素的 action 属性。
注释:formaction 属性适用于 type="submit" 和 type="image"。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!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 :
该属性与 type="submit" 配合使用。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!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>
|
和
1 2 3 4 5 6 7 8 9 10 11 | <!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 元素会获得焦点。
1 2 3 4 5 6 7 8 9 10 11 12 13 | <!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中文网。
相关推荐:
JQuery中DOM操作――wrap
django 使用 request 获取浏览器发送的参数
React this绑定的几点思考
以上就是HTML5 form新增的属性的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
HTML5 canvas绘图之drawimage() 方法的详细介绍(代码示例)
断点续传原理是什么?怎么利用HTML5实现文件断点续传
HTML5的data-*自定义属性是什么
h5的文本格式化使用方法
企业开发中使用h5有哪些注意事项
HTML5规定是否对元素进行拼写和语法检查的属性spellcheck
HTML5+css3实现无插件拖拽上传图片(支持预览与批量)的详情介绍
基于 HTML5 canvas 的 3d 渲染引擎界面以及吸附等效果的运用
h5的filereader分布读取文件应该如何使用以及其方法简介
h5中的弹窗无法用webview弹出怎么解决
更多相关阅读请进入《HTML5》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » HTML5 form新增的属性