jquery ajax显示对号和错号,用于验证输入验证码是否正确
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了jquery ajax显示对号和错号,用于验证输入验证码是否正确,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2083字,纯文字阅读大概需要3分钟。
内容图文
<script src = "js/j.js" ></script>
<script>
$ ( document ). ready ( function ( e ) {
$ ( ‘#yes‘ ). hide ();
$ ( ‘#no‘ ). hide ();
$ ( ‘input[name=gcode]‘ ). keyup ( function (){
if ( $ ( this ). val (). length == 4 ){
$ . post ( ‘gbook.php‘ ,{ cc : $ ( ‘input[name=gcode]‘ ). val ()}, function ( msg ){
if ( msg == ‘yes‘ ){
$ ( ‘#no‘ ). hide ();
$ ( ‘#yes‘ ). show ();
} else {
$ ( ‘#yes‘ ). hide ();
$ ( "#no" ). show ();
}
});
}
});
});
</script>
. sl - error - verifycode {
background - image : url ( "images/icons.png" );
background - position : - 26px 0 ;
background - repeat : no - repeat ;
display : block ;
font - size : 18px ;
height : 23px ;
line - height : 20px ;
margin - left : 180px ;
margin - top : - 25px ;
position : relative ;
text - align : center ;
width : 20px ;
z - index : 2 ;
}
. sl - correct - verifycode {
background - image : url ( "images/icons.png" );
background - position : - 50px 0 ;
background - repeat : no - repeat ;
display : block ;
font - size : 18px ;
height : 23px ;
line - height : 20px ;
margin - left : 180px ;
margin - top : - 25px ;
position : relative ;
text - align : center ;
width : 20px ;
z - index : 2 ;
}
<tr>
<td height = "40" align = "right" > 验证码: </td>
<td height = "40" ><span class = "addred" > * </span></td>
<td height = "40" >
<input type = "text" name = "gcode" id = "textfield7" class = "txtlist" >
<span id = "yes" class = "sl-correct-verifycode" ></span><span id = "no" class = "sl-error-verifycode" ></span>
<img style = " float : right ; margin - top :- 25px ; margin - right : 300px ; " align = "middle" src = "inc/cc.php" onClick = " this . src = ‘inc/cc.php?‘ + new Date " title = "点击换一张图片" width = "100px" ></td>
</tr>
<? php
session_start ();
if ( isset ( $_POST [ ‘cc‘ ])){
$cc = strtolower ( $_POST [ ‘cc‘ ]);
$ss = strtolower ( $_SESSION [ ‘code‘ ]);
if ( $cc == $ss ){
echo "yes" ;
} else {
echo "no" ;
}
}
原文:http://www.cnblogs.com/lsr111/p/4593982.html
内容总结
以上是互联网集市为您收集整理的jquery ajax显示对号和错号,用于验证输入验证码是否正确全部内容,希望文章能够帮你解决jquery ajax显示对号和错号,用于验证输入验证码是否正确所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。