9 HTML5之表单
2017-02-23 11:46
148 查看
HTML5表单
HTML5的表单组件大致分为了四类:文字组件,列表组建,选择组件,按钮组件。 表单的标记是<form></form>,各种表单组件需放在<form></form>标记内。
<form></form>标记
语法:<form method=[@""](https://my.oschina.net/u/2433434) action=[@""](https://my.oschina.net/u/2433434)>
method
该属性用于设置发送数据的方式,有get和post两种, 至于做过移动端的开发的童鞋都清楚,在这就不多说了,哈哈
action
该属性表示将数据发往哪里, 如果是发往电子邮件,其语法:<form method=@"get" action=@"mailto:wewqdas@qq.com?subject=dsaj" enctype="text/plain">
enctype
enctype表示表单的编码方式,只有post时有效,共三种方式:
1.enctype="application/x-www-form-urlencode":默认值,如果忽略,表示采用此种编码
2.enctype="multi/form-data":用于文件上传
3.enctype="text/plain"表示将表单属性发往电子邮箱时,必须将设为这种属性,不然乱码
autocomplete
用来设置input组件是否使用自动完成功能
novalidate
用来设置是否在发送表单时验证表单,如果需要验证填入novalidate。
实际练习效果
参考代码
<!doctype html> <html> <head> <title> 我的博客首页 </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <html lang="zh-CN"> </head> <body> <form method="post" action="mailto:1054539558@qq.com?subject=练习哈哈哈哈" enctype="text/plain"> 账号:<input type="text" name="username" /> <br /> 密码:<input type="text" name="userpassword"> <br /> <input type="submit" value="提交"> <input type="reset" value="取消"> </form> </body> </html>
相关文章推荐
- html5-表单属性及<!DOCTYPE> 标签
- 10款精美的HTML5表单登录联系和搜索表单
- HTML5表单增强
- 体验html5新添加的一些表单元素
- 超酷HTML5和CSS3实现的登录及其注册功能表单
- HTML5表单及其他新增和改良元素
- 12种炫酷HTML5 SVG和CSS3表单浮动标签特效
- HTML5表单新特征简介与举例
- html5表单中的<button>按钮
- HTML5的 input:file上传 样式美化及表单异步提交
- HTML5表单的基本属性和使用方法
- XHTML、表单、HTML5、图形、媒体、API
- 后台开发学习(四)HTML5表单的使用PHP环境搭载和HTML表单的提交
- html5中新增表单控件和属性
- html5表单和文件
- HTML5表单
- HTML5---疯狂的表单
- HTML5_表单元素
- HTML5 表单验证
- HTML5 学习总结(二)——HTML5新增属性与表单元素