验证码的特殊样式
来源:互联网 发布:安徒生 知乎 编辑:程序博客网 时间:2024/06/18 04:51
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>Document</title>
<style type="text/css">
input{
margin-top: 80px;
width: 20%;
margin-right: 3%;
border: none;
outline: none;
border-bottom: 1px solid #ccc;
text-align: center;
}
.box{
margin-right: 0;
}
</style>
</head>
<body>
<input type="tel" id="userinfo" index='0' maxlength="1"/>
<input type="tel" id="userinfo2" index='1' maxlength="1"/>
<input type="tel" id="userinfo3" index='2' maxlength="1"/>
<input type="tel" id="userinfo4" index='3' maxlength="1" class="box"/>
<button>按钮</button>
</body>
<script src="jquery-2.1.4.min.js"></script>
<script type="text/javascript">
var higoodthingsdata = {
index: 0,
morebackspace: false
}
function nextinput(index) {
index++;
$('[index=' + index + ']').focus();
higoodthingsdata.index = index;
}
function preinput(index) {
index--;
$('[index=' + index + ']').focus();
$('[index=' + index + ']').val('');
higoodthingsdata.index = index;
}
$(this).keyup(function (even) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if(((keycode >= 49) && (keycode <= 57)) || ((keycode >= 96) && (keycode <= 105))){
nextinput(higoodthingsdata.index);
higoodthingsdata.morebackspace = false;
}else if(keycode == 8) {
if(higoodthingsdata.morebackspace) {
preinput(higoodthingsdata.index);
}else {
$('[index=' + higoodthingsdata.index + ']').val('');
higoodthingsdata.index --;
}
higoodthingsdata.morebackspace = true;
}else {
$('[index=' + higoodthingsdata.index + ']').val('');
}
})
$(this).on("click",function(){
if($("#userinfo").val()==""){
$("#userinfo").focus();
}
})
$("button").on("click",function(){
console.log($("#userinfo").val());
})
</script>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>Document</title>
<style type="text/css">
input{
margin-top: 80px;
width: 20%;
margin-right: 3%;
border: none;
outline: none;
border-bottom: 1px solid #ccc;
text-align: center;
}
.box{
margin-right: 0;
}
</style>
</head>
<body>
<input type="tel" id="userinfo" index='0' maxlength="1"/>
<input type="tel" id="userinfo2" index='1' maxlength="1"/>
<input type="tel" id="userinfo3" index='2' maxlength="1"/>
<input type="tel" id="userinfo4" index='3' maxlength="1" class="box"/>
<button>按钮</button>
</body>
<script src="jquery-2.1.4.min.js"></script>
<script type="text/javascript">
var higoodthingsdata = {
index: 0,
morebackspace: false
}
function nextinput(index) {
index++;
$('[index=' + index + ']').focus();
higoodthingsdata.index = index;
}
function preinput(index) {
index--;
$('[index=' + index + ']').focus();
$('[index=' + index + ']').val('');
higoodthingsdata.index = index;
}
$(this).keyup(function (even) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if(((keycode >= 49) && (keycode <= 57)) || ((keycode >= 96) && (keycode <= 105))){
nextinput(higoodthingsdata.index);
higoodthingsdata.morebackspace = false;
}else if(keycode == 8) {
if(higoodthingsdata.morebackspace) {
preinput(higoodthingsdata.index);
}else {
$('[index=' + higoodthingsdata.index + ']').val('');
higoodthingsdata.index --;
}
higoodthingsdata.morebackspace = true;
}else {
$('[index=' + higoodthingsdata.index + ']').val('');
}
})
$(this).on("click",function(){
if($("#userinfo").val()==""){
$("#userinfo").focus();
}
})
$("button").on("click",function(){
console.log($("#userinfo").val());
})
</script>
</html>
阅读全文
0 0
- 验证码的特殊样式
- 特殊样式表的格式
- 抄 样式的特殊符合
- 验证 js 的特殊字符
- 测试 验证的特殊字符
- 针对IE6写特殊样式的方法
- css的特殊样式ime-mode
- 前端的几种特殊样式
- primefaces对于样式表的特殊规定
- 前台验证特殊字符的制作方法
- 样式中的特殊字符
- UIButtont特殊样式
- UITABBAR特殊样式设置
- CSS 特殊样式
- html标签对象的特性和特殊样式归纳
- 数组索引的特殊样式ArrayName[num]和num[ArrayName]
- Android : TextView 显示特殊样式(SpannableStringBuilder的应用)
- Android TextView的特殊使用:阴影,加样式
- Unreal教学(3)——游戏相机控制(Game-Controlled Cameras)
- 深入理解事务--Spring事务的传播机制
- js分页插件入门
- Mongodb常用命令
- 用imageROI来增加某范围的像素
- 验证码的特殊样式
- DWR3.0
- 机器学习自动化运维 DBMS
- Qt事件和事件循环
- DOM的getElementById()、getElementsByName()、getElementsByTagName()方法
- Windows安装maven
- 计算机学科路线规划与建议
- 翡翠教育“创新创业联合基金”怎么样
- 冲突部分Beyond Compare如何解决