input

input标签类型:text【文本框,能使用input自带的正则(pattern),但不推荐使用自带的正则,placeholder是占位符用于友好提示这文本框是做什么用的】

<input type="text" name="uname" id="uname" value="" pattern="[a-z A-Z]{2,8}[0-9]{1-14}" placeholder="请输入用户名" />

 

input标签类型:password【密码框,输出的内容所有都显示为*号】

<input type="password" name="pass" id="pass" value="" />

 

input标签类型:reset【重置按钮,使所有input会到默认,value为按钮提示的内容】

<input type="reset" name="pass" id="pass" value="重置" />

 

input标签类型:submit【提交按钮,把数据提交到服务器上面】

<input type="submit" name="pass" id="pass" value=“提交” />

 

input标签类型:radio【单选框,name属性必须为一致】

<label for="wom">
男:<input type="radio" name="sex" id="wom" value="" />
</label>
<label for="man">
女:<input type="radio" name="sex" id="man" value="" />
</label>

 

input标签类型:checkbox【复选框,checked可以指定默认复选框】

我是c位出道贼牛X的k公主:
<input type="checkbox" value="唱" checked/>
<input type="checkbox" value="跳" checked/>
<input type="checkbox" value="rap" checked/>
<input type="checkbox" value="篮球" checked/>
<input type="checkbox" value="来自美国" checked/>

 

input标签类型:color【RGB颜色的选择器,value能指定选择器的默认颜色】

<input type="color" value="#FFFFFF" />

 

input标签类型:file【能指定电脑中的文件。】

<input type="file">

file有2个属性分别是:

multiple【多个文件可以被同时选中. 只要用户所在的平台允许 (摁住 Shift 或者 ctrl), 用户可以选择多个文件】写法如下:

<input type="file" id="file" name="file" multiple />

accept【可以指定上传文件的格式。例如指定是.jpg格式就只有jpg图片可见】

<form action="">
  <label for="file">
    <input type="file" id="file" name="file" accept=".jpg,.jpeg,.png" />
  </label>
</form>

 

input标签类型:hidden【允许 Web 开发者存放一些用户不可见、不可改的数据,在用户提交表单时,这些数据会一并发送出。比如,正被请求或编辑的内容的 ID,或是一个唯一的安全令牌。这些隐藏的 <input> 元素在渲染完成的页面中完全不可见,而且没有方法可以使它重新变为可见。】

<input type="hidden" name="ez" id="ez" value="qwer13214" />

 

input标签类型:button【是一个没有任何功能的按钮,需要用javascript加上动作才可以使用。功能简单,比起<button></button>是一个功能强大的按钮,更美观。】

<input type="button" />

转载于:https://www.cnblogs.com/lllusory/p/11550803.html

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值