<!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. &,引用复制@,忽略错误提示

    function &chhua() { static $b="www.jb51.net";//申明一个静态变量 $b=$b."WEB开发"; echo ...

  2. 服务器设置SSH 长连接

    1.echo $TMOUT 如果显示空白,表示没有设置, 等于使用默认值0, 一般情况下应该是不超时. 如果大于0, 可以在如/etc/profile之类文件中设置它为0. 2.修改/etc/ssh/ ...

  3. OI总结(垃圾排版就忽略了吧)

    学OI一年了,到现在联赛所需要的知识已经基本学完了.现在,有必要回过头来,总结总结自己一年来学到的知识以及得到的经验教训. 基础 语言基础 C++的语言基础啥的就略了吧. 算法复杂度分析 O:复杂度的 ...

  4. faad解码aac

    // faad2.cpp : 定义控制台应用程序的入口点. #include "stdafx.h" #include <cassert> #include <io ...

  5. 实现Redis的主从复制配置

    实现Redis的主从复制配置比较简单,而且容易明白. 下图是要配置的主从复制结构图: 1.说明 Redis主从复制中一个主服务可以有多个从服务,一个从服务可以有多个从服务. 配置比较简单,只需要更改r ...

  6. 用Kibana和logstash快速搭建实时日志查询、收集与分析系统

    Logstash是一个完全开源的工具,他可以对你的日志进行收集.分析,并将其存储供以后使用(如,搜索),您可以使用它.说到搜索,logstash带有一个web界面,搜索和展示所有日志. kibana ...

  7. ACM/ICPC 之 双向链表_构造列表-模拟祖玛 (TSH OJ-Zuma(祖玛))

    这一题是TsingHua OJ上的一道题目,学堂在线的一位数据结构老师的题目(原创),所以我直接把题目先贴下来了,这道题对复习双向链表很有帮助,而且也对数据结构中List,也就是对列表的回顾也是很有帮 ...

  8. 9.SpringMVC和json结合传递参数

    input的值一定要用.attribute来取值.val( )只能用可以看看开源社区jQuery的ajax请求.html():读取和修改一个元素的HTML内容,详情.html():.text():读取 ...

  9. ajax提交表单

    $.ajax({ type: "POST", url: action, data: $('#checkout-form').serialize(), success: functi ...

  10. 【python】id()函数

    来源:百度知道 >>> a=2.0 >>> b=2.0 >>> id(a) 524440880 >>> id(b) 524440 ...