<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<form action="文档结构和语义.html" method="post" oninput="updateSum();">
<!--tabindex tab键切换的优先级 -->
普通文本框<input type="text" tabindex="1" pattern="[a-z]{3,32}" />
<!--pattern 正则表达式验证-->
<br />
一行文本<input type="tel" tabindex="3" /><br />
一行文本<input type="search" autofocus list="searchList" tabindex="2" />
<datalist id="searchList">
<option>aaa</option>
<option>bbb</option>
</datalist>
<br />
绝对URL地址<input type="url" /><br />
有效的e-mail地址<input type="email" placeholder="aaa@qq.com" required id="email" /><br />
日期及时间(使用UTC时间)<input type="datetime" /><br />
不带时区的日期<input type="date" min="2010-08-01" max="2010-11-11" step="7" />
<!--step=“7” 在min日期上以7天为单位增减-->
<br />
不带时区的月份<input type="month" /><br />
不带时区的年及周<input type="week" /><br />
不带时区的时间<input type="time" min="14:30" max="19:30" step="3600" /><br />
时区的当期日期及时间<input type="datetime-local" /><br />
数字<input type="number" max="1" min="0" step="0.1" /><br />
一定范围内的数值<input type="range" /><br />
十六进制RGB值<input type="color" /><br />
<!--图形化表示已知范围内的测量标准,比如车子里的油表-->
<meter value="0.5"></meter>
<progress value="3" max="10"></progress> price:<input type="number" id="price"/> quantity:<input type="number" id="quantity" />
<output name="sum" id="sum" for="price quantity"></output><!--输出updateSum()计算的值 -->
<input type="submit" name="name" value="提交" />
</form>
<script type="text/javascript">
function updateSum() {
document.getElementById("sum").value = parseFloat(document.getElementById("price").value) * parseFloat(document.getElementById("quantity").value);
}; window.onload = function () { //document.getElementById("email").addEventListener("invalid", function () {
// this.style.border = "dotted 2px red";
//}); document.getElementById("email").onchange = function() {
if (!this.checkValidity()) {
this.style.border = "dotted 2px red";
} else {
this.style.border = "";
}
};
alert(document.querySelectorAll(":required")[0].tagName); //input
alert(document.getElementById("email").nextSibling.tagName);// br };
</script> </body>
</html>

HTML5学习之智能表单(二)的更多相关文章

  1. Html5学习进阶四 表单元素和表单属性

    HTML5 的新的表单元素: HTML5 拥有若干涉及表单的元素和属性. 本章介绍以下新的表单元素: datalist keygen output 浏览器支持 Input type IE Firefo ...

  2. HTML5学习系列之表单与文件

    article元素 article元素代表文档.页面或应用程序中独立的.完整的.可以独自被外部引用的内容.它可以是一篇博客或报刊中的文章.一篇论坛帖子.一段用户评论或独立的插件,或者其他任何独立的内容 ...

  3. HTML5 学习总结(二)——HTML5新增属性与表单元素

    一.HTML5新增属性 1.1.contextmenu contextmenu的作用是指定右键菜单. <!DOCTYPE html> <html> <head> & ...

  4. HTML5 智能表单

    HTML5 智能表单 1.表单新增属性  ☀ autofocus 属性 <input type="text" autofocus/>设置 autofocus 属性,使文 ...

  5. HTML5智能表单

    HTML5 智能表单 1.表单新增属性  ☀ autofocus 属性 <input type="text" autofocus/>设置 autofocus 属性,使文 ...

  6. 第86天:HTML5应用程序标签和智能表单

    一.HTML5应用程序标签 1.datalist需要数据载体 input list属性指向数据源 2.progress进度条 -webkit-appearance: none;   /*如果要改默认样 ...

  7. BootStrap 智能表单系列 二 BootStrap支持的类型简介

    代码如下(链接地址:https://github.com/xiexingen/Bootstrap-SmartForm/blob/master/demo/form1-basic.html): <! ...

  8. HTML5_智能表单

    1.HTML5中为了方便排版,可以使from中的表单标签脱离from的嵌套.方法:from指定ID,所有表单标签均添加from=id属性. <form action="http://l ...

  9. SpringMVC学习系列 之 表单标签

    http://www.cnblogs.com/liukemng/p/3754211.html 本篇我们来学习Spring MVC表单标签的使用,借助于Spring MVC提供的表单标签可以让我们在视图 ...

随机推荐

  1. Android之NetworkOnMainThreadException异常

    看名字就应该知道,是网络请求在MainThread中产生的异常 先来看一下官网的解释: Class Overview The exception that is thrown when an appl ...

  2. OOP复习笔记

    /*OOP相关的代名词不做讲解*/ OOP的三大特征: 封装 - 继承 - 多态 -----------------------------------目录---------------------- ...

  3. 2016年10月31日--网页 Windows对象操作

    Window.opener:打开当前窗口的源窗口,如果当前窗口是首次启动浏览器打开的,则opener是null. Window.open(URL,name,features,replace):open ...

  4. Tip

    Windows 开栈命令 -Wl,--stack=1000000000 //stack-size B Linux 开栈命令 -ulimit -a -ulimit -s size //stack-siz ...

  5. silk与opencore-amr音频编码对比

    silk与opencore-amr编码对比 在采样率8000 单声道 16位采样精度情况下 silk的压缩率为 1/15 opencore-amr 1/17 对比图 原始的音频编码 opencore- ...

  6. TorgoiseGit配置ssh密钥

    TortoiseGit 使用扩展名为ppk的密钥,而不是ssh-keygen生成的rsa密钥.使用命令ssh-keygen -C "邮箱地址" -t rsa产生的密钥在Tortoi ...

  7. neutron的基本原理

    neutron是openstack的一个重要模块,也是比较难以理解和debug的模块之一. 我这里安装如图安装了经典的三个节点的Havana的Openstack   图1 分三个网络: Externa ...

  8. Function接口 – Java8中java.util.function包下的函数式接口

    Introduction to Functional Interfaces – A concept recreated in Java 8 Any java developer around the ...

  9. IPC---共享内存

    共享内存就是允许两个或多个不相关的进程访问同一个逻辑内存.共享内存是在两个正在运行的进程之间共享和传递数据时,不需要在客户进程和服务器进程之间幅值,因此是最快的一种IPC.不同进程之间共享的内存通常安 ...

  10. poj 1847( floyd && spfa )

    http://poj.org/problem?id=1847 一个水题,用来熟悉熟悉spfa和floyd的. 题意:有m条的铁路,要从x,到y, 之后分别就是条铁路与其他铁路的交点.第一个输入的为有n ...