<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>第三个页面</title>
<style>
textarea:required{
background-color: lightyellow;
}
body{
font-family: "微软雅黑";
max-width: :600px;
padding: 0px 30px;
}
h1{
margin-top: 0px;
}
p{
margin-top: 0px;
}
fieldset{
margin-bottom: 15px;
padding: 10px;
}
legend{
padding: 0px 3px;
font-weight: bold;
font-variant: small-caps;
}
label{
width: 110px;
display: inline-block;
vertical-align: top;
margin: 6px;
}
em{
font-weight:bold ;
font-style: normal;
color: blue;
}
input:focus{
background: #FFFFE0;
}
input,textarea{
width: 250px;
}
textarea{
height: 10;
}
input [type=checkbox]{
width: 10px;
}
input [type=radio]{
width: 10px;
}
input [type=submit]{
width: 150px;
padding: 10px;
}
</style>
<script type="text/javascript" language="JavaScript">
function validataCom(input){
if(input.value.length < 20){
input.setCustomValidity("请您再输入一些信息");
}else{
input.setCustomValidity("");
}
}
function mySubmit()
{
var resultvalue = getValue();
localStorage.setItem("001",resultvalue);
var str = localStorage.getItem("001");
var result = str.split(",");
for(var i = 0; i < result.length; i++)
alert(result[i]);
}
function getValue()
{
var user = $("name").value;
var tel = $("tel").value;
var email = $("email").value;
var birthday = $("birthday").value;
var age = $("age").value;
var rm_w = $("rm").checked?"男":"女";
var conts = $("conments").value;
var c1 = $("c1").checked?"斑马":"";
var c2 = $("c2").checked?"老虎":"";
var c3 = $("c3").checked?"狮子":"";
var c4 = $("c4").checked?"大象":"";
var totalValue = user+","
+tel+","
+email+","
+birthday+","
+age+","
+rm_w+","
+conts+","
+c1+","
+c2+","
+c3+","
+c4;
return totalValue;
}
function $(name)
{
return document.getElementById(name);
}
</script>
</head>
<body>
<h1>个人信息</h1>
<form action="" onsubmit="mySubmit()" method="post">
<p></p>
<fieldset>
<legend>Contact Details</legend>
<label>姓名</label><em>*</em><!--显示文本不可编辑-->&nbsp;
<input id="name" type="text" value="" placeholder="请输入姓名"
required="required" autofocus="autofocus" /><br/>
<label>Tel&nbsp;&nbsp;</label>
<input id="tel" type="tel"" value="" placeholder="请输入电话" /><br/>
<label>邮箱&nbsp;</label>
<input id="email" type="email" required="required" value="" placeholder="请输入邮件地址">
</fieldset>
<fieldset>
<legend>Personal Information</legend>
<label>生日&nbsp;&nbsp;</label>
<input id="birthday" type="date" required="required" /><br/>
<label>年龄&nbsp;&nbsp;</label>
<input id="age" type="number" min="1" max="120" step="1" required="required" /><br/>
<label>性别&nbsp;&nbsp;</label>
<input id="rm" type="radio" name="gender" value="男"/>男
<input id="rw" type="radio" name="gender" value="女"/>女
<!--<select id="sex">
<option>---请选择性别---</option>
<option value="male">-------男-------</option>
<option value="female">-------女-------</option>
</select>-->
<br/>
<label>编辑</label><br/>
<textarea id="conments" rows="8" cols="23" oninput="validataCom(this)" required="required" >
</textarea>
</fieldset>
<fieldset>
<legend>请输入您喜欢的动物</legend>
<input id="c1" type="checkbox" /> 斑马
<input id="c2" type="checkbox" /> 老虎
<input id="c3" type="checkbox" /> 狮子
<input id="c4" type="checkbox" /> 大象
</fieldset>
<p>
<input type="submit" value="提交" />
<input type="submit" value="提交" />
</p>
</form>
</body>
</html>

HTML5入门八---缓存控件元素的值的更多相关文章

  1. CPF 入门教程 - 各个控件介绍(八)

    CPF C#跨平台桌面UI框架 系列教程 CPF 入门教程(一) CPF 入门教程 - 数据绑定和命令绑定(二) CPF 入门教程 - 样式和动画(三) CPF 入门教程 - 绘图(四) CPF 入门 ...

  2. IOS版App的控件元素定位

    前言 Android版App的控件元素可以通过Android studio自带的工具uiautomatorviewer来协助定位! IOS版App的控件元素可以通过Appium来实现(未实现),或ap ...

  3. Webview页面的控件元素定位

    前言 现在有很多App都是Hybrid的,即有原生的页面又有Webview的页面,元素的可以通过uiautomatorviewer工具 进行控件元素的定位,Webview页面的则无法通过此方式定位,而 ...

  4. Android版App的控件元素定位

    前言 如何获取页面上各控件元素,无论是Web自动化还是App自动化,此步骤都是非常关键的! Web页面的控件元素可通过开发者选项(Chrome浏览器的F12)来协助定位,App端也是有相应的工具来协助 ...

  5. Python+Appium自动化测试(10)-TouchAction类与MultiAction类(控件元素的滑动、拖动,九宫格解锁,手势操作等)

    滑动屏幕方法swipe一般用于对页面进行上下左右滑动操作,但自动化过程中还会遇到其他情况,如对控件元素进行滑动.拖拽操作,九宫格解锁,手势操作,地图的放大与缩小等.这些需要针对控件元素的滑动操作,或者 ...

  6. JQuery动态添加控件并取值

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  7. python通过win32api轻松获取控件的属性值

    1.如何利用句柄操作windows窗体 首先,获得窗体的句柄  win32api.FindWindows() 第二,获得窗体中控件的id号,spy++ 第三,根据控件的ID获得控件的句柄(hwnd)  ...

  8. winform中的dateTimePicker控件设置默认值为空

    winform中的dateTimePicker控件设置默认值为空   第一步:设置Format的属性值为“Custom” 第二步:设置CustomFormat的属性值为空,需要按一个空格键

  9. WPF-学习笔记 动态修改控件Margin的值

    原文:WPF-学习笔记 动态修改控件Margin的值 举例说明:动态添加一个TextBox到Grid中,并设置它的Margin: TextBox text = new TextBox(); t_gri ...

随机推荐

  1. python 获取 mac 地址 的代码

    python 获取 mac 地址 的例子,有需要的朋友可以参考下. #!/bin/python import os import re def GetMac():     if os.name ==  ...

  2. 使用Eclipse开发,Java Compiler中Annotation Processin不出现的解决方案

    第一步:在Eclipse菜单栏中点击Help,在点击inatall New Software 第二步:在Work with中找到 Juno - http://download.eclipse.org/ ...

  3. 解决Handler与Activity同步冲突

    这个问题可以由Handler的一个子类HandlerThread来解决. 程序参考自Mars老师的Android课程第一季第十五集. 代码以及注释有所改动,如下: package com.handle ...

  4. Winform Krypton控件使用(一)

    在学生健康系统中前期考虑需求中,考虑过在C/S下使用Winform或WPF完成项目, 在winform下,考虑过两套插件,一个是DotNetBar, 控件很多,但这个是收费的,考虑到以后的版权和费用问 ...

  5. 利用ajax在javascript中获取后台的值

    <script type="text/javascript"> function login() { var sa = WebForm1.Hello().value; ...

  6. 隐藏wmware到系统托盘

    [此方法是百度到的,经整理放在这里以防忘记.] 1.打开VMware Authorization Service服务.控制面板--管理工具--服务,在里面找到VMware Authorization ...

  7. 安装360后,visual studio 经常报各种莫名其妙的错误的解决方案

    安装360后,visual studio  经常报各种莫名其妙的错误,每次都要查找错误的解决方案 而且网上关于这个的好少,以后只要碰到了这种情况我就记录下吧 今天碰到的情况是打开WCF服务时出现   ...

  8. Tools for Presention

    ZoomIt v4.5 http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx 微软的教师演示工具 主要有放大,画图,倒计时的功能. ...

  9. Linux内核目录

    linux目录结构 目录 1.树状目录结构图 2./目录 3./etc/目录 4./usr/目录 5./var/目录 6./proc/目录 7./dev/目录 该文章主要来自于网络进行整理. 目录结构 ...

  10. SkyDrive Pro client now available as standalone download. Hurray!

    SkyDrive Pro client now available as standalone download. Hurray! by  Todd O. Klindt  on 5/21/2013 1 ...