技术标签: 提示消息 hint HTML placeholder 提示文本
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>html input 输入框提示(hint)内容的实现</title>
</head>
<body>
<form action="/testform.asp" method="get">
Postcode:<input type="text" name="zip_code" pattern="[0-9]{6}" placeholder="请输入0-9的6位数编码"/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
显示提示内容“请输入...”
获取焦点后hint消失
输入内容后hint消失
没有按照规则 pattern="[0-9]{6}"输入了7位数字,报错
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>文本框获取焦点或输入文字后提示语消失</title>
<script type="text/javascript" src="04-11.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#focus .input_txt").each(function(){
var thisVal=$(this).val();
//判断文本框的值是否为空,有值的情况就隐藏提示语,没有值就显示
if(thisVal!=""){
$(this).siblings("span").hide();
}else{
$(this).siblings("span").show();
}
//聚焦型输入框验证
$(this).focus(function(){
$(this).siblings("span").hide();
}).blur(function(){
var val=$(this).val();
if(val!=""){
$(this).siblings("span").hide();
}else{
$(this).siblings("span").show();
}
});
})
$("#keydown .input_txt").each(function(){
var thisVal=$(this).val();
//判断文本框的值是否为空,有值的情况就隐藏提示语,没有值就显示
if(thisVal!=""){
$(this).siblings("span").hide();
}else{
$(this).siblings("span").show();
}
$(this).keyup(function(){
var val=$(this).val();
$(this).siblings("span").hide();
}).blur(function(){
var val=$(this).val();
if(val!=""){
$(this).siblings("span").hide();
}else{
$(this).siblings("span").show();
}
})
})
})
</script>
<style type="text/css">
form{width:400px;margin:10px auto;border:solid 1px #E0DEDE;background:#FCF9EF;padding:30px;box-shadow:0 1px 10px rgba(0,0,0,0.1) inset;}
label{display:block;height:40px;position:relative;margin:20px 0;}
span{position:absolute;float:left;line-height:40px;left:10px;color:#BCBCBC;cursor:text;}
.input_txt{width:398px;border:solid 1px #ccc;box-shadow:0 1px 10px rgba(0,0,0,0.1) inset;height:38px;text-indent:10px;}
.input_txt:focus{box-shadow:0 0 4px rgba(255,153,164,0.8);border:solid 1px #B00000;}
.border_radius{border-radius:5px;color:#B00000;}
h2{font-family:"微软雅黑";text-shadow:1px 1px 3px #fff;}
</style>
</head>
<body>
<form class="border_radius" id="focus">
<h2>聚焦型提示语消失</h2>
<label><span>用户名或邮箱地址</span><input type="text" class="input_txt border_radius" /></label>
<label><span>密码</span><input type="text" class="input_txt border_radius" /></label>
</form>
<form class="border_radius" id="keydown">
<h2>输入型提示语消失</h2>
<label><span>用户名或邮箱地址</span><input type="text" class="input_txt border_radius" /></label>
<label><span>密码</span><input type="text" class="input_txt border_radius" /></label>
</form>
<p><a href="http://www.w3school.com.cn/tiy/t.asp?f=html_basic">W3School在线测试</a></p></script></p>
</body>
</html>
<script type="text/javascript" src="04-11.js"></script> <pre name="code" class="html">04-11.js <span style="font-family: Arial, Helvetica, sans-serif;">是将URL:</span><span style="font-family: Arial, Helvetica, sans-serif;"><a target=_blank href="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js">http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js</a>代码copy到本地,方便每次快速载入,亦可以写成如下格式:</span>
<pre name="code" class="html"><script type="text/javascript" src="<pre name="code" class="html">http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js
"></script>
如果场景中由于模型等影响,导致运行时场景无法加载烘焙效果,将World Setting中的Compress Lightmaps勾选
目录:引言环境需求分析&前期准备淘宝购物流程回顾秒杀的实现代码梳理总结0 引言今天给大家提供一种思路,用Python实现秒杀订单,借用自动化方式完成最优解。1 环境操作系统:WindowsPython版本:3.7.22 需求分析&前期准备2.0 需求分析我们的目标是秒杀淘宝的订单,这里面有几个关键点,首先需要登录淘宝,其次你需要准备好订单,最后要在...
shell脚本之循环结构的学习,通过学习for循环、while循环,switch循环等常用的循环结构及在循环中经常使用的各种比较符号,不如数字的比较的,字符串的比较等,达到快速掌握shell脚本的目的!
本文主要阐述预处理的工作内容及常见预处理指令的用法等,相信看完本文以后,你对预处理的理解会步入一个新的台阶。
启动tomcat报以下异常used by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring-mybatis.xml]: Instantiation of bean f...
一、String类一、概述 String是字符串的类类型,用于描述字符串事物。字符串是一个特殊的对象。特殊之处就在于: Stings= new String();和String s1=””;两种写法都是在创建对象,使用起来一样。 二、特点 字符串最大的特点就是:一旦被初始化就不可以被改变。例:
写在前面的话为什么要写这篇博客其实学习机器学习让人相当吐血的一部就是搭建环境,这一个月以来重装系统的次数我一只手已经数不过来了,加上笔记本电脑本身的原因,遇到了许许多多的问题,这篇博客记录重装系统的过程以及系统刚刚装完之后进行的操作。安装环境安装前状态:windows10 和 Ubuntu1.04TLS双系统电脑:联想Y430P待安装系统:Ubuntu16.04TLS...
首先给出udev的主页:http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html 1.启动错误信息使用NFS挂载minimal根文件系统,启动时出现mount nbd*设备失败信息。分析应该是NFS文件系统注册了多个nbd*设备(可以从/sys/block/目录下查看到),而udev在coldplug处理阶段,会去
python的工程结构/编码规范/特殊模块/导包路径
1.主从复制的原理(position)异步复制(主从复制)master节点不会关心slave节点的状态,只需要写自己的数据即可能不能完成复制看slave节点的io线程和sql线程是否开启mysql的主从配置又叫replication,AB复制,基于binlog二进制日志主数据库必须开启binlog二进制日志才能进行复制mysql的主从复制(异步复制)(基于position)把一个事件拆...
Atitit.获取swing ui 按钮控件的id 与名字 与JPDA 调试体系 1. Swing Inspector是一个Java Swing/AWT用户界面分析和调试工具,功能与firebug类似,22. 类似spylite ,firebug33. Eclipse vm param34. Cltr+f12显示主界面35. Ctrl+鼠标找到控件36. JPDA(J
少年你写程序关注这种旁支末节干嘛,pi在运算中不需要多精确,sym(pi)是符号变量,进行的已经不算是数值运算了,它可以有任意充分的精度.matlab是调用其他符号计算引擎计算的.具体可学习下符号计算.举个例子pi在系统内被认为是一个充分精确地数 比如 3.1415926535898sym(pi)是符号,相当于π.运算中sin(3.1415926535898)是数值运算sin(