怎么使用HTML5的input元素

本篇内容介绍了“怎么使用HTML5的input元素”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

成都创新互联公司专注于蕉岭企业网站建设,响应式网站设计,商城网站制作。蕉岭网站建设公司,为蕉岭等地区提供建站服务。全流程按需求定制制作,专业设计,全程项目跟踪,成都创新互联公司专业和态度为您提供的服务

表单元素之 input 元素 - text, password, url, telephone, email, search, file, radio, checkbox, button, submit, reset, number, range, image, hidden, color, datetime, datetime-local, date, time, month, week

input 元素的通用属性 - autocomplete, placeholder, pattern, dirname, size, maxlength, readonly, required, list, multiple, min, max, step

示例

1、text - 文本框element/form/input/text.html

       text              

2、password - 密码框element/form/input/password.html

       password                          alert(document.getElementsByTagName("input")[0].value);           

3、url - url 框element/form/input/url.html

       url                          alert(document.getElementsByTagName("input")[0].value);            

4、telephone - 电话框element/form/input/telephone.html

       telephone                          alert(document.getElementsByTagName("input")[0].value);            

5、email - 电子邮件框element/form/input/email.html

       email                          alert(document.getElementsByTagName("input")[0].value);            

6、search - 搜索框element/form/input/search.html

       search                          alert(document.getElementsByTagName("input")[0].value);            

7、file - 用于上传文件element/form/input/file.html

       file              

8、radio - 单选框element/form/input/radio.html

       radio                 radio button title          radio button title              alert(document.getElementsByTagName("input")[0].value);            

9、checkbox - 复选框element/form/input/checkbox.html

       checkbox                 checkbox title              alert(document.getElementsByTagName("input")[0].checked);        

10、button - 一般按钮element/form/input/button.html

       button                   

11、submit - 提交按钮element/form/input/submit.html

       submit                                     

12、reset - 复位按钮element/form/input/reset.html

       reset                                     

13、number - 数字输入框element/form/input/number.html

       number                          alert(document.getElementsByTagName("input")[0].value);           

14、range - 滑动条element/form/input/range.html

       range                          alert(document.getElementsByTagName("input")[0].value);            

15、image - 显示图片element/form/input/image.html

       image                   

16、hidden - 隐藏元素,不会显示element/form/input/hidden.html

       hidden                          alert(document.getElementsByTagName("input")[0].value);            

17、color - 颜色选择器element/form/input/color.html

       color                          alert(document.getElementsByTagName("input")[0].value);            

18、datetime - 日期时间输入/选择框(UTC), datetime-loca - 日期时间输入/选择框(本地时区), date - 日期输入/选择框, time - 时间输入/选择, month - 月份输入/选择框, week - 星期输入/选择框element/form/input/datetime_datetime-local_date_time_month_week.html.html

       datetime datetime-local date time month week                                                                

19、input 元素的通用属性element/form/input/_attributes.html

       input 元素的通用属性: autocomplete, placeholder, pattern, dirname, size, maxlength, readonly, required, list, multiple, min, max, step                                                                                                                                                                                                                                                                                                                                                                                                                                                       

“怎么使用HTML5的input元素”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


分享标题:怎么使用HTML5的input元素
文章URL:http://ybzwz.com/article/gedegj.html