使⽤jquery实现图形拖动图⽚验证码案例及代码完整版
<%--
Created by IntelliJ IDEA.
User: Lenovo
Date:2020/2/12
Time:17:14
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<html>
<head>
<title>滑动图⽚验证码</title>
<link rel="stylesheet" type="text/css" href="css/verify.css"/>
<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/verify.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
#btnOK{
border: none;
color: gray;
jquery在线图片padding:5px 10px;
text-align: center;
display: inline-block;
font-size:16px;
}
</style>
</head>
<body>
<form method="post" action="success.jsp">
<div>
<label>验证:</label>
<div id="slider"></div>
</div>
<div>
<input type="submit" value="登录" id="btnOK" disabled="disabled"/>
</div>
<script type="text/javascript">
$('#slider').slideVerify({
type :2,//类型
vOffset :5,//误差量,根据需求⾃⾏调整
vSpace :5,//间隔
imgName :['1.jpeg','2.jpeg'],
imgSize :{
width:'400px',
height:'200px',
},
blockSize :{
width:'40px',
height:'40px',
},
barSize :{
width :'400px',
height :'40px',
},
ready :function(){
},
success :function(){
$("#btnOK").prop("disabled","");
$("#btnOK").css("background-color","#5cb85c");
//......后续操作
},
error :function(){
// alert('验证失败!');
}
});
});
</script>
</form>
</body>
</html>
验证成功跳转页⾯
<%--
Created by IntelliJ IDEA.
User: Lenovo
Date:2020/2/9
Time:12:29
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%> <html>
<head>
<title>验证码输⼊成功</title>
</head>
<body>
<h2>验证码输⼊成功</h2>
</body>
</html>
效果如图:
验证成功的结果:
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论