html5input表单标签新属性

初探h5

    • 一,h5 新增表单类型
    • 二,新增表单属性
    • 三,code demo

一,h5 新增表单类型

 •email	邮箱地址•url	网络地址•number	数字框•range	滑块•Date pickers (date, month, week, time, datetime, datetime-local)	日期时间框•search	搜索框•color	颜色选择苯环

二,新增表单属性

 •autocomplete	自动完成(同name的input标签提交过数据之后,将记录提交的值以供自动完成)•autofocus 让表单中的某个元素在页面加载完成之后自动获得焦点•form 允许在form标签以外的input标签归纳到指定form标签•form overrides (formaction, formenctype, formmethod, formnovalidate, formtarget)重写form标签中的相关属性formtarget表单重写表单提交的target属性_blank 表示在新的窗口的打开可以写某个框架iframe的name属性值•height 和 width  控制input标签的style.Width和style.Height属性•list 在input标签中引用datalist列表的id值•min, max 和 step 用于number、range标签,控制最小值、最大值、单次的滑动值•multiple 用于email、file标签中允许file标签一次性选择多个文件进行上传•pattern (regexp)  input标签值的正则验证表达式•placeholder 在input标签没空值时提示文本•required 表示input标签是必填项新增全局属性•contenteditable 允许某个标签中内容可以被编辑•data-xxx-xxx 自定义扩展属性

三,code demo

<!DOCTYPE html>
<html><head><meta charset="UTF-8"><title></title><!--作者:echo lovely时间:2020-07-29描述:my work -> 案例demo--></head><body><fieldset><legend>datalist</legend><input type="text" list="myList"/>  <!-- 利用id绑定datalist --><datalist id="myList"><option label="xxxHub" value="github.com"></option><option value="zhihu.com"></option><option value="bilibili.com"></option></datalist></fieldset><fieldset><legend>required</legend><form><input type="text" required="required"/><input type="submit" value="提交"/></form></fieldset><fieldset><legend>email</legend><form><input type="email" required="required"/><input type="submit" value="提交"/>				</form></fieldset><fieldset><legend>url</legend><form><input type="url" required="required"/><input type="submit" value="提交"/>				</form></fieldset><fieldset><legend>number</legend><form><input type="number" /><input type="submit" value="提交"/>				</form></fieldset><fieldset><legend>range</legend><form><input type="range" min="0" max="100" step="1" onchange="document.getElementById('rangeLable').innerText=this.value"/> <!-- 滑块 --><label id="rangeLable"></label><input type="submit" value="提交"/> 				</form></fieldset><fieldset><legend>Date pickers (date, month, week, time, datetime, datetime-local)</legend><input type="date"/><input type="month"/><input type="week"/><input type="time"/><input type="datetime" placeholder="no shit.."/><input type="datetime-local"/></fieldset><fieldset><legend>•search	</legend><input type="search" /> <!-- 输入的数据可被搜索引擎检索 --></fieldset><fieldset><legend>color</legend><input type="color" /></fieldset><br /> <br /><fieldset><legend>autocomplete</legend><form action="#"><input type="text" name="tName" autocomplete="on"/> <!-- 默认自动补充 --><input type="text" name="sName" autocomplete="off"/><input type="submit" /></form></fieldset>	<fieldset><legend>autofocus</legend><form action="#"><input type="text" name="tName" autofocus="autofocus"/> <!-- 进入页面自动获得焦点 --><input type="submit" /></form></fieldset>			<fieldset><legend>form</legend><form id="outSideForm" action="##"><input type="text" name="tName" /> <!-- 允许在form外面写input表单--><input type="submit" /></form><input type="text" form="outSideForm" name="sName"/> <!-- 需要注明当前表单的id --></fieldset>		<fieldset><legend>form-overrides</legend>		<form action="1.html"><input type="text" name="tName" /> <!-- input新增 formaction, formenctype, formmethod, formnovalidate, formtarget --><input type="submit" formmethod="post" formaction="2.html"/></form></fieldset>		<fieldset><legend>height-width</legend><input type="file" multiple="multiple" height="60px" /> <!-- 用于email. file文件多选 --></fieldset><fieldset><legend>contenteditable</legend><div contenteditable="true">hhh, adorable</div></fieldset><fieldset><legend>自定义扩展属性 data-xxx-xxx</legend><input type="text" id="txt" value="666" data-age=12 data-my-gender="male" /></fieldset><script>var txt = document.getElementById("txt");console.log(txt.dataset); // DOMStringMapconsole.log(txt.dataset.age + "\t" + txt.dataset.myGender);</script><fieldset><legend>拖拽</legend><!-- 可拖动 --><div id="imgDiv" style="border: palegoldenrod;"><img src="33.jpg" draggable="true" ondragstart="imgStart(event)" width="130px" height="180px"/></div><div ondragover="imgOver(event)" ondrop="imgDrop(event)" style="border: dashed palegreen; width: 300px; height: 300px;"></div></fieldset><script>function imgStart(event) {// 拿到当前图片的资源var imgSrc = event.target.src;// console.log(imgSrc);// 保存拖动数据event.dataTransfer.setData("imgSrc", imgSrc);}function imgOver(event) {// 移动时默认事件不被触发event.preventDefault();}function imgDrop(event) {event.preventDefault();// 拿到图片路径var imgSrc = event.dataTransfer.getData("imgSrc");// console.log(imgSrc);event.target.innerHTML = "<img width='130px' height='180px' src='" + imgSrc + "'/>";}</script></body>
</html>
  • datalist 用来js绑定数据,提高体验度

  • 拖拽演示


在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/420767.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

关于java的JIT知识

1.JIT的工作原理图 工作原理 当JIT编译启用时&#xff08;默认是启用的&#xff09;&#xff0c;JVM读入.class文件解释后&#xff0c;将其发给JIT编译器。JIT编译器将字节码编译成本机机器代码。 通常javac将程序源码编译&#xff0c;转换成java字节码&#xff0c;JVM通过解释…

Storage 使用

关于web项目数据存储1. 存储种类2. localStorage/sessionStorage2.1 概念2.2 api的使用3. 学生curd测试localStorage针对客户端存储讲 ——storage1. 存储种类 1. 分为服务器端和客户端的存储 2. 服务器端&#xff1a;1. 内存存储(临时)application session request pageConte…

信息抽取--新词提取

&#xff08;纯属为了记录自己学习的点滴过程&#xff0c;引用资料都附在参考列表&#xff09; 1 基本概念 什么是新词&#xff08;是什么&#xff09; 新词是一个相对的概念&#xff0c;每个人的标准都不一样&#xff0c;所以我们这里定义: 词典之外的词语(OOV)称作新词。 …

spring 基于xml方式配置aop

目录什么是aop模拟aop配置什么是aop 什么是aop 作用 在程序运行期间&#xff0c;在不修改源码的情况下对方法进行功能增强 优势 减少重复代码 提高开发效率 并且便于开发2.aop关键概念 模拟aop 目标接口 package com.lovely.proxy.aop;public interface TargetInterface …

word2vec相关资料

blogs&#xff1a; http://www.douban.com/note/323504583/ and http://www.zhihu.com/question/21661274 references: http://arxiv.org/pdf/1310.4546v1.pdf and http://www.fit.vutbr.cz/research/groups/speech/servite/2010/rnnlm_mikolov.pdf转载于:https://www.cnblogs…

信息抽取--关键词提取

&#xff08;纯属为了记录自己学习的点滴过程&#xff0c;引用资料都附在参考列表&#xff09; 1 基本概念 什么是关键词&#xff08;是什么&#xff09; 大略的讲就是文章中重要的单词&#xff0c;而不限于词语的新鲜程度。 什么样的单词是重要的单词&#xff0c;恐怕这是个…

h5离线缓存

html5离线缓存1. 简介1.1 什么是离线缓存1.2 优点1.3 针对对象2. 实现方式2.1 使用3. window.applicationCache对象相关api3.1 属性3.2 事件3.3 方法1. 简介 1.1 什么是离线缓存 HTML5中引入了应用程序缓存&#xff0c;意味着Web应用可以进行数据缓存&#xff0c;并可以在没有…

3389爆破DUBrute_2.1

3389专业爆破 DUBrute_2.1.zip http://pan.baidu.com/s/1pJE0t5L转载于:https://www.cnblogs.com/lieyan/p/3859696.html

信息抽取--短语提取

&#xff08;纯属为了记录自己学习的点滴过程&#xff0c;引用资料都附在参考列表&#xff09; 1 基本概念 短语提取 在信息抽取领域&#xff0c;另一项重要的任务就是提取中文短语&#xff0c;也即固定多字词表达串的识别。短语提取经常用于搜索引擎的自动推荐&#xff0c;文…

ACM1598并查集方法

find the most comfortable road Problem DescriptionXX星有许多城市&#xff0c;城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构&#xff09;进行交流&#xff0c;每条SARS都对行驶在上面的Flycar限制了固定的Speed&#xff0c;同时XX星人对…

h5 server send event(sse)

1. sse概述 概念&#xff1a; H5支持使用JS脚本不间断的访问服务器(推送)轮询: 页面使用js的定时器&#xff0c;定时发送请求查询最新数据 使用js将最新数据加载至页面 每发送一次数据&#xff0c;需要建立新的连接 时间间隔由客户端决定 优点&#xff1a;不需要刷新页面、实…

信息抽取--关键句提取

&#xff08;纯属为了记录自己学习的点滴过程&#xff0c;引用资料都附在参考列表&#xff09; 1 基本概念 关键句提取 在一些场合&#xff0c;关键词或关键短语依然显得碎片化&#xff0c;不足以表达完整的主题。这时通常提取中心句子作为文章的简短摘要。 2 问题 关键句提…

Netty 中 IOException: Connection reset by peer 与 java.nio.channels.ClosedChannelException: null

最近发现系统中出现了很多 IOException: Connection reset by peer 与 ClosedChannelException: null 深入看了看代码, 做了些测试, 发现 Connection reset 会在客户端不知道 channel 被关闭的情况下, 触发了 eventloop 的 unsafe.read() 操作抛出 而 ClosedChannelException 一…

注解方式实现aop

aop注解实现spring配置文件目标接口&#xff0c;目标实现类&#xff0c;切面类 注解写法使用spring-test测试spring配置文件 <?xml version"1.0" encoding"UTF-8"?> <beans xmlns"http://www.springframework.org/schema/beans"xmln…