热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

HTML表单元素之input元素

介绍HTML5:表单元素之input元素表单元素之input元素-text,password,url,telephone,email,search,file,radio,check

 

介绍
HTML 5: 表单元素之 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

doctype html>
<html>
<head>
<title>texttitle>
head>
<body>



<input type&#61;"text" autocomplete&#61;"on" placeholder&#61;"请输入。。。" />

body>
html>


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

doctype html>
<html>
<head>
<title>passwordtitle>
head>
<body>



<input type&#61;"password" value&#61;"111111" />

<script type&#61;"text/Javascript">

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

script>

body>
html>


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

doctype html>
<html>
<head>
<title>urltitle>
head>
<body>



<input type&#61;"url" value&#61;"http://www.cnblogs.com/" />

<script type&#61;"text/Javascript">

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

script>

body>
html>


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

doctype html>
<html>
<head>
<title>telephonetitle>
head>
<body>



<input type&#61;"telephone" value&#61;"110" />

<script type&#61;"text/Javascript">

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

script>

body>
html>


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

doctype html>
<html>
<head>
<title>emailtitle>
head>
<body>



<input type&#61;"email" value&#61;"www&#64;abc.com" />

<script type&#61;"text/Javascript">

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

script>

body>
html>


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

doctype html>
<html>
<head>
<title>searchtitle>
head>
<body>



<input type&#61;"search" value&#61;"我是 search&#xff0c;是一个有特殊语义的 text" />

<script type&#61;"text/Javascript">

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

script>

body>
html>


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

doctype html>
<html>
<head>
<title>filetitle>
head>
<body>



<input type&#61;"file" />

body>
html>


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

doctype html>
<html>
<head>
<title>radiotitle>
head>
<body>



<input id&#61;"rad" type&#61;"radio" checked name&#61;"rad" />
<label for&#61;"rad">radio button titlelabel>

<input id&#61;"rad2" type&#61;"radio" name&#61;"rad" />
<label for&#61;"rad2">radio button titlelabel>

<script type&#61;"text/Javascript">

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

script>

body>
html>


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

doctype html>
<html>
<head>
<title>checkboxtitle>
head>
<body>



<input id&#61;"chk" type&#61;"checkbox" checked />
<label for&#61;"chk">checkbox titlelabel>

<script type&#61;"text/Javascript">

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

script>

body>
html>


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

doctype html>
<html>
<head>
<title>buttontitle>
head>
<body>



<input type&#61;"button" value&#61;"button" />

body>
html>


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

doctype html>
<html>
<head>
<title>submittitle>
head>
<body>



<form action&#61;"#">
<input type&#61;"text" />

<input type&#61;"submit" value&#61;"submit button" />
form>

body>
html>


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

doctype html>
<html>
<head>
<title>resettitle>
head>
<body>



<form action&#61;"#">
<input type&#61;"text" />

<input type&#61;"reset" value&#61;"reset" />
form>

body>
html>


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

doctype html>
<html>
<head>
<title>numbertitle>
head>
<body>



<input type&#61;"number" value&#61;"10" min&#61;"10" max&#61;"100" step&#61;"10" />

<script type&#61;"text/Javascript">

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

script>

body>
html>


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

doctype html>
<html>
<head>
<title>rangetitle>
head>
<body>



<input type&#61;"range" value&#61;"50" min&#61;"0" max&#61;"100" step&#61;"10" />

<script type&#61;"text/Javascript">

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

script>
body>
html>


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

doctype html>
<html>
<head>
<title>imagetitle>
head>
<body>



<input type&#61;"image" src&#61;"http://www.w3.org/html/logo/downloads/HTML5_Logo_512.png" />

body>
html>


16、hidden - 隐藏元素&#xff0c;不会显示
element/form/input/hidden.html

doctype html>
<html>
<head>
<title>hiddentitle>
head>
<body>



<input type&#61;"hidden" value&#61;"我是 hidden" />

<script type&#61;"text/Javascript">

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

script>

body>
html>


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

doctype html>
<html>
<head>
<title>colortitle>
head>
<body>



<input type&#61;"color" value&#61;"#FF0000" />

<script type&#61;"text/Javascript">

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

script>

body>
html>

 

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

doctype html>
<html>
<head>
<title>datetime datetime-local date time month weektitle>
head>
<body>



<input type&#61;"datetime" />
<br />

<input type&#61;"datetime-local" />
<br />

<input type&#61;"date" />
<br />

<input type&#61;"time"" />
<br />

<input type&#61;"month" />
<br />

<input type&#61;"week" />

body>
html>


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

doctype html>
<html>
<head>
<title>input 元素的通用属性: autocomplete, placeholder, pattern, dirname, size, maxlength, readonly, required, list, multiple, min, max, steptitle>
head>
<body>



<form action&#61;"#">


<input type&#61;"text" autocomplete&#61;"on" />
<br />


<input type&#61;"text" autocomplete&#61;"on" placeholder&#61;"请输入。。。" />
<br />


<input pattern&#61;"[0-9]" value&#61;"6" />
<br />


<input type&#61;"text" name&#61;"textName" dirname&#61;"textdir" />
<br />


<input type&#61;"text" value&#61;"webabcd" size&#61;"10" />
<br />


<input type&#61;"text" maxlength&#61;"10" />
<br />


<input type&#61;"text" value&#61;"webabcd" readonly />
<br />


<input type&#61;"text" required />
<br />


<input type&#61;"email" list&#61;"contacts" />
<datalist id&#61;"contacts">
<option value&#61;"aabb&#64;aa.com" />
<option value&#61;"ccdd&#64;cc.com" />
<option value&#61;"eeff&#64;ee.com" />
datalist>
<br />


<input type&#61;"email" list&#61;"contacts2" multiple />
<datalist id&#61;"contacts2">
<option value&#61;"aabb&#64;aa.com" />
<option value&#61;"ccdd&#64;cc.com" />
<option value&#61;"eeff&#64;ee.com" />
datalist>
<br />


<input type&#61;"range" value&#61;"50" min&#61;"0" max&#61;"100" step&#61;"10" />
<br />

<input type&#61;"submit" value&#61;"submit" />

form>
body>
html>


转:https://www.cnblogs.com/guolanzhu/p/3467664.html



推荐阅读
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • ASP.NET2.0数据教程之十四:使用FormView的模板
    本文介绍了在ASP.NET 2.0中使用FormView控件来实现自定义的显示外观,与GridView和DetailsView不同,FormView使用模板来呈现,可以实现不规则的外观呈现。同时还介绍了TemplateField的用法和FormView与DetailsView的区别。 ... [详细]
  • 本文介绍了在处理不规则数据时如何使用Python自动提取文本中的时间日期,包括使用dateutil.parser模块统一日期字符串格式和使用datefinder模块提取日期。同时,还介绍了一段使用正则表达式的代码,可以支持中文日期和一些特殊的时间识别,例如'2012年12月12日'、'3小时前'、'在2012/12/13哈哈'等。 ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • Spring源码解密之默认标签的解析方式分析
    本文分析了Spring源码解密中默认标签的解析方式。通过对命名空间的判断,区分默认命名空间和自定义命名空间,并采用不同的解析方式。其中,bean标签的解析最为复杂和重要。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • MyBatis多表查询与动态SQL使用
    本文介绍了MyBatis多表查询与动态SQL的使用方法,包括一对一查询和一对多查询。同时还介绍了动态SQL的使用,包括if标签、trim标签、where标签、set标签和foreach标签的用法。文章还提供了相关的配置信息和示例代码。 ... [详细]
  • Ihavethefollowingonhtml我在html上有以下内容<html><head><scriptsrc..3003_Tes ... [详细]
  • {moduleinfo:{card_count:[{count_phone:1,count:1}],search_count:[{count_phone:4 ... [详细]
  • 本文介绍了使用PHP实现断点续传乱序合并文件的方法和源码。由于网络原因,文件需要分割成多个部分发送,因此无法按顺序接收。文章中提供了merge2.php的源码,通过使用shuffle函数打乱文件读取顺序,实现了乱序合并文件的功能。同时,还介绍了filesize、glob、unlink、fopen等相关函数的使用。阅读本文可以了解如何使用PHP实现断点续传乱序合并文件的具体步骤。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • Voicewo在线语音识别转换jQuery插件的特点和示例
    本文介绍了一款名为Voicewo的在线语音识别转换jQuery插件,该插件具有快速、架构、风格、扩展和兼容等特点,适合在互联网应用中使用。同时还提供了一个快速示例供开发人员参考。 ... [详细]
  • 1,关于死锁的理解死锁,我们可以简单的理解为是两个线程同时使用同一资源,两个线程又得不到相应的资源而造成永无相互等待的情况。 2,模拟死锁背景介绍:我们创建一个朋友 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • 如何在elementui table 内容里面放多选框?
    本文介绍了如何在elementui的table组件中放置多选框的方法,并提供了相应的代码示例和UI图效果。通过阅读本文,你将了解如何将UI图中的多选框放到表格内容中,并实现相应的功能。 ... [详细]
author-avatar
william浩浩_597
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有