网站常用验证码效果
来源:互联网 发布:华为p9手机壳淘宝 编辑:程序博客网 时间:2024/04/27 14:06
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>换一换</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style type="text/css">
body{padding:0;margin:0;}
ul{padding:0;margin:0;}
.box{ width:600px;height: auto;margin:0 auto; }
.box>div{margin-top: 15px;font-size: 18px}
.box .code-box .code{font-size: 22px;color: #f00;}
.box .code-box .huan{font-size: 18px;cursor: pointer;}
.box .input input{width: 200px;height: 28px;}
.button{text-align: center;width: 80px;height: 30px;background: #FF3333;line-height: 30px;color: #fff;cursor: pointer;border-radius: 5px}
.change{color:#f00;font-size:16px;}
</style>
</head>
<body>
<div class="box">
<div class="code-box">
<span>验证码</span>
<span class="code"></span>
<span class="huan">换一张</span>
</div>
<div class="input">
<span>输入验证码</span>
<input type="text" id="code" placeholder="输入验证码">
<span class="change"></span>
</div>
<div class="button">提交</div>
</div>
<script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script type="text/javascript">
$(function(){
$(".huan").on("click",createCode)
$(".button").on("click",validation)
createCode()//一打开页面就先加载一张验证码出来
})
var code1;
function createCode(){
var l=4;
var code1='';
for(var i=0;i<l;i++){
var mynum =new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
var charindex=Math.floor(Math.random()*mynum.length);
code1+=mynum[charindex];
$(".code").html(code1);
}
}
function validation(){
var code=$(".code").html();
var Code=$("#code").val();
if(Code.length<=0){
$(".change").show().html("验证码为空");
}else if(Code !=code && Code.length>0){
$(".change").show().html("验证码有误");
createCode();
}else{
$(".change").show().html("验证码正确");
}
$("#code").focus(function(){
$(".change").html("");
$(this).val('');
})
}
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>换一换</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style type="text/css">
body{padding:0;margin:0;}
ul{padding:0;margin:0;}
.box{ width:600px;height: auto;margin:0 auto; }
.box>div{margin-top: 15px;font-size: 18px}
.box .code-box .code{font-size: 22px;color: #f00;}
.box .code-box .huan{font-size: 18px;cursor: pointer;}
.box .input input{width: 200px;height: 28px;}
.button{text-align: center;width: 80px;height: 30px;background: #FF3333;line-height: 30px;color: #fff;cursor: pointer;border-radius: 5px}
.change{color:#f00;font-size:16px;}
</style>
</head>
<body>
<div class="box">
<div class="code-box">
<span>验证码</span>
<span class="code"></span>
<span class="huan">换一张</span>
</div>
<div class="input">
<span>输入验证码</span>
<input type="text" id="code" placeholder="输入验证码">
<span class="change"></span>
</div>
<div class="button">提交</div>
</div>
<script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script type="text/javascript">
$(function(){
$(".huan").on("click",createCode)
$(".button").on("click",validation)
createCode()//一打开页面就先加载一张验证码出来
})
var code1;
function createCode(){
var l=4;
var code1='';
for(var i=0;i<l;i++){
var mynum =new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
var charindex=Math.floor(Math.random()*mynum.length);
code1+=mynum[charindex];
$(".code").html(code1);
}
}
function validation(){
var code=$(".code").html();
var Code=$("#code").val();
if(Code.length<=0){
$(".change").show().html("验证码为空");
}else if(Code !=code && Code.length>0){
$(".change").show().html("验证码有误");
createCode();
}else{
$(".change").show().html("验证码正确");
}
$("#code").focus(function(){
$(".change").html("");
$(this).val('');
})
}
</script>
</body>
</html>
0 0
- 网站常用验证码效果
- 网站常用效果
- 常用的JS验证效果
- 网站常用验证码讲解之一:绘制纯数字的网站验证码
- jquery验证码验证效果
- 网站常用验证码之二:绘制数字与字母组合的验证码
- 验证码倒计时效果
- 验证码定时效果
- 网站验证码
- 网站验证码思考
- 网站验证码
- 网站验证码
- 网站验证码
- 网站验证码getValidImage
- 破解网站验证码
- 一个网站上通用的验证效果的函数
- 图片效果的验证码
- Android实现验证码效果
- HDU 5890 Eighty seven(bitset优化dp)
- console的用法
- Android之Socket通信
- 雪糕棒临摹
- 移动APP漏洞自动化检测平台建设
- 网站常用验证码效果
- SQL Server删除distribution数据库
- 《常用的几种Linux功能介绍》
- Hive总结(十一)Hive自定义函数UDF
- [Qt笔记]设置VS2015下的应用工程图标
- 算法基础3—归并排序
- 剑指Offer--图的操作
- ubuntu14.04学习过程中各种小技巧集合
- MyEclipse优化技巧 (转)