input type属性

在HTML5中,规定的 input type 属性值如下:

1.button                定义可点击按钮

2.checkbox                复选框

<form action="demo-form.php">
  <input type="checkbox" name="vehicle[]" value="Bike"> 我有一辆自行车<br>
  <input type="checkbox" name="vehicle[]" value="Car"> 我有一辆小轿车<br>
  <input type="checkbox" name="vehicle[]" value="Boat"> 我有一艘船<br>
  <input type="submit" value="提交">
</form>

3.color                   定义拾色器,定义后出现颜色调板,只支持谷歌和opera

4.date                        定义 date 控件(包括年、月、日,不包括时间)。只支持谷歌、opera、safari

5.datetime               定义date和time空间,仅支持safari、opera

6.datetime-local             定义date和time空间。只支持谷歌、opera、safari

7.email                定义用于e-mail地址字段,提交时会验证。safari不支持

8.file                  上传文件

9.hidden               定义隐藏字段

10.image                定义图像为提交按钮

<input type="image" src="img_submit.gif" alt="Submit">

11.month              定义month和year空间。只支持谷歌、opera、safari

12.number              定义数字输入的字段。只支持谷歌、opera、safari

数量 ( 1 到 5 之间): <input type="number" name="quantity" min="1" max="5">

13.password             定义密码字段

14.radio               单选项

<form>
  <input type="radio" name="gender" value="女"> 女<br>
  <input type="radio" name="gender" value="女"> 男<br>
</form>

15.range             定义用于精确值不重要的输入数字的控件(比如 slider 控件)。您也可以设置可接受数字的限制:

<input type="range" name="points" min="1" max="10">

16.reset              定义重置按钮,重置为初始值

17.search              定义搜索字段。只支持谷歌、opera

18.submit             定义提交按钮

19.tel               定义输入电话号码字段,注:目前主流浏览器都不支持

20.text              文本

21.time             定义输入时间 IE和火狐不支持

22.url              输入url字段,苹果浏览器不支持

23.week             定义week和year控件,IE和火狐不支持

input样式,

获得焦点清除输入框边框:outline:none;

 输入框景背景透明:
<input style="background:transparent;border:1px solid #ffffff">

鼠标划过输入框,输入框背景色变色:
<inputvalue="Type here" name="user_pass" type="text" size="29" onmouseover="this.style.borderColor=‘black‘;this.style.backgroundColor=‘plum‘"
style="width: 106; height: 21"
onmouseout="this.style.borderColor=‘black‘;this.style.backgroundColor=‘#ffffff‘" style="border-width:1px;border-color=black">
<input type="text" id="oText" style="border:5px dotted red;color:red" onfocus="borderColor(this);" onblur="clearTimeout(oTime);">

自动横向廷伸的输入框:
<input type="text" style="huerreson:e xpression(this.width=this.scrollWidth)" value="abcdefghijk">

自动向下廷伸的文本框:
<textarea name="content" rows="6" cols="80" onpropertychange="if(this.scrollHeight>80) this.style.posHeight=this.scrollHeight+5">回车</textarea>

只有下划线的文本框:
<input style="border:0;border-bottom:1 solid black;background:;">
时间: 2024-07-30 13:25:36

input type属性的相关文章

&lt;input&gt; type 属性

单行文本域 语法格式:<input  type = “text” 属性 = “值” /> 常用属性 1  name:文本框的名字.命名规则是:可以包含字母.数字.下划线,只能以字母开头. 2  type:表单元素的类型. 3  value:文本框中的值. 4  size:文本框的长度,以“字符”为单位. 5  maxLength:最多可以输入多少个字符,超出的就输不进去了. 6  readonly:只读属性.可以选中,但不能修改.如:readonly = “readonly” 7  disab

HTML 5 &lt;input&gt; type 属性

1.button 定义可点击的按钮(通常与 JavaScript 一起使用来启动脚本).2.checkbox 定义复选框.3.color 定义拾色器.4.date 定义 date 控件(包括年.月.日,不包括时间).5.datetime 定义 date 和 time 控件(包括年.月.日.时.分.秒.几分之一秒,基于 UTC 时区)6.datetime-local 定义 date 和 time 控件(包括年.月.日.时.分.秒.几分之一秒,不带时区)7.email 定义用于 e-mail 地址的

jquery改变input的type属性

今天在做一个登录页面时,当我把input的type属性值设置为password后,input的默认值被“*”替换(图一),导致输入框不能正常提示用户输入信息,代码如下: 1 <input type="password" class="text-input fs pass" value="请输入密码"> (图一) 如果把密码输入框的type属性更改为text后,不利于密码输入时的保密性.所以需要在密码输入框获得焦点时通过jquery的a

html5与js关于input[type=&#39;text&#39;]文本框value改变触发事件一些属性的区别oninput,onpropertychange,onchange和文本框的value点击全选状态onclick=&quot;select();&quot;。做购物车页面时会要用到。

关于input[type='text']文本框value改变触发事件一些属性的区别oninput,onpropertychange,onchange和文本框的点击全选状态onclick="select();".做购物车页面时会要用到. input[type='text']文本框value改变触发事件一些属性的区别oninput,onpropertychange,onchange: 1.onchange事件与onpropertychange事件的区别:onchange事件在内容改变(两次

ie8下修改input的type属性报错

摘要: 现在有一个需求如图所示,当用户勾选显示明文复选框时,要以明文显示用户输入的密码,去掉勾选时要变回密文,刚开始想到的就是修改输入框的type来决定显示明文还是密文,使用jQuery的attr来做试验,测试结果是chrome,Firefox,ie9+都是好的,在ie8以下就会报错,查找了下原因,ie8中是不允许修改input的type属性,最终换了种思路实现. 当勾选显示明文时替换输入框为type="text",不勾选时在将输入框替换为type="password&quo

移动端定制软键盘样式 配置input属性的type属性

1.当你的input输入的数据为链接地址时type属性可改为 type=url 最下面一栏就会出现.com 提高用户体验 2.当你的input输入的数据为email时type属性可改为 type=email 最下面一栏就会出现@符号 3.当你的input输入的数据为电话时type属性可改为 type=tel 软键盘就会显示这个样子. 4.当你的input输入的数据为电话时type属性可改为 type=number 显示介个样子

JQuery中如何动态修改input的type属性

代码如下: 1 jQuery(".member_id").focus(function() { 2 jQuery(this).val(''); 3 }).blur(function() { 4 5 if(jQuery(this).val() == "") { jQuery(this).val("账号"); } 6 }); 7 8 jQuery(".member_passwd").focus(function() { 9 jQu

HTML &lt;input&gt; 标签的 type 属性

下面的表单拥有两个输入字段以及一个提交按钮: <form action="form_action.asp" method="get"> <p>First name: <input type="text" name="fname" /></p> <p>Last name: <input type="text" name="lname&

html5 input的type属性启动数字输入法

html5 input的type属性启动数字输入法 当文本框只能输入数字是一个很常见的需求,比如电话号码,身份证号,卡号, 数量....等等只允许数字输入,为了更好的用户体验性,直接写出 启动数字键盘的需求,我和大多数人一样用   this.style.imeMode='disabled'; imeMode有四种形式,分别是: active 代表输入法为中文inactive 代表输入法为英文auto 代表打开输入法 (默认)disable 代表关闭输入法 发现在Android手机上是不行的. 解