jQuery Real Person驗(yàn)證碼插件防止表單自動(dòng)提交
本文介紹的jQuery插件有點(diǎn)特殊,防自動(dòng)提交表單的驗(yàn)證工具,就是我們經(jīng)常用到的驗(yàn)證碼工具,先給大家看看效果。
效果圖如下:

使用說(shuō)明
需要使用jQuery庫(kù)文件和Real Person庫(kù)文件
同時(shí)需要自定義驗(yàn)證碼顯示的CSS樣式
使用實(shí)例
1、包含文件部分
<script type="text/javascript" src="jquery-latest.pack.js"></script>
<script type="text/javascript" src="jquery.realperson.js"></script>
<style type="text/css">@import "jquery.realperson.css";</style>
2、HTML部分
<input type="text" id="biuuu" name="defaultReal">
3、Javascript部分
$("#biuuu").realperson();
如上實(shí)例,就可以實(shí)現(xiàn)一個(gè)防自動(dòng)提交表單的驗(yàn)證碼工具,同時(shí)可指定驗(yàn)證碼字符的長(zhǎng)度,如下:
$("#biuuu").realperson({length: 5});
今天所講到的jQuery Real Person Plugin,就是一個(gè)完全由JavaScript編寫(xiě)而成的jQuery驗(yàn)證碼插件。
jQuery插件Real Person 點(diǎn)擊可刷新實(shí)例講解
<!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>Untitled Document</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.realperson.js"></script>
<link href="jquery.realperson.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function(){
$('#Gideon').realperson({length: 5});
})
</script>
</head>
<body>
<input type="text" id="Gideon" name="defaultReal">
</body>
</html>
注:如果持續(xù)無(wú)法驗(yàn)證成功的話,請(qǐng)嘗試下面的方法:
<?php
function rpHash($value) {
$hash = 5381;
$value = strtoupper($value);
for($i = 0; $i < strlen($value); $i++) {
$hash = (($hash << 5) + $hash) + ord(substr($value, $i));
}
return $hash;
}
?>
替換為:
<?
function rpHash($value)
{
$hash = 5381;
$value = strtoupper($value);
for($i = 0; $i < strlen($value); $i++) $hash = (leftShift32($hash, 5) + $hash) + ord(substr($value, $i));
return $hash;
}
function leftShift32($number, $steps)
{
$binary = decbin($number);
$binary = str_pad($binary, 32, "0", STR_PAD_LEFT);
$binary = $binary.str_repeat("0", $steps);
$binary = substr($binary, strlen($binary) - 32);
return ($binary{0} == "0" ? bindec($binary) : -(pow(2, 31) - bindec(substr($binary, 1))));
}
?>
以上就是為大家介紹了jQuery驗(yàn)證碼插件Real Person的使用方法,小編整理的可能有些不全面,希望大家多多諒解。
- Jquery插件easyUi表單驗(yàn)證提交(示例代碼)
- jquery+ajax驗(yàn)證不通過(guò)也提交表單問(wèn)題處理
- jQuery中驗(yàn)證表單提交方式及序列化表單內(nèi)容的實(shí)現(xiàn)
- jquery validate和jquery form 插件組合實(shí)現(xiàn)驗(yàn)證表單后AJAX提交
- 基于jQuery實(shí)現(xiàn)表單提交驗(yàn)證
- jquery實(shí)現(xiàn)表單驗(yàn)證并阻止非法提交
- jQuery EasyUI提交表單驗(yàn)證
- jQuery form插件之formDdata參數(shù)校驗(yàn)表單及驗(yàn)證后提交
- Jquery練習(xí)之表單驗(yàn)證實(shí)現(xiàn)代碼
- Jquery表單驗(yàn)證失敗后不提交的解決方法
相關(guān)文章
基于jquery自己寫(xiě)tab滑動(dòng)門(mén)(通用版)
今天與大家分享一下,自己寫(xiě)的滑動(dòng)門(mén)。在網(wǎng)上也搜索了一下,沒(méi)發(fā)現(xiàn)比較好的,于是乎自己寫(xiě)一吧~寫(xiě)起來(lái)也很簡(jiǎn)單,為了方便使用,我已經(jīng)盡量封裝好了。好吧,閑話少說(shuō),直接上代碼吧2012-10-10
jQuery響應(yīng)enter鍵的實(shí)現(xiàn)思路
當(dāng)用戶在表單里數(shù)據(jù)完數(shù)據(jù)后,之間按enter鍵就可以執(zhí)行查詢或者保存的操作。實(shí)現(xiàn)的思路如下2014-04-04
jQuery實(shí)現(xiàn)錨點(diǎn)向下平滑滾動(dòng)特效示例
下面小編就為大家?guī)?lái)一篇jQuery實(shí)現(xiàn)錨點(diǎn)向下平滑滾動(dòng)特效示例。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-08-08
jquery.validate.js 多個(gè)相同name的處理方式
本文通過(guò)代碼給大家介紹了jquery.validate.js 多個(gè)相同name的處理方式,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧2017-07-07
Jquery實(shí)現(xiàn)地鐵線路指示燈提示牌效果的方法
這篇文章主要介紹了Jquery實(shí)現(xiàn)地鐵線路指示燈提示牌效果的方法,實(shí)例分析了jQuery動(dòng)態(tài)顯示特效的使用技巧,需要的朋友可以參考下2015-03-03
uploadify多文件上傳參數(shù)設(shè)置技巧
uploadify插件配置實(shí)用比較簡(jiǎn)單,很多開(kāi)發(fā)者都喜歡使用。但是它有個(gè)缺點(diǎn)就是剛加載的時(shí)候稍微慢了一秒左右,本文通過(guò)一段代碼實(shí)例給大家介紹uploadify多文件上傳參數(shù)設(shè)置技巧,朋友們一起學(xué)習(xí)吧2015-11-11
淺析jQuery Ajax請(qǐng)求參數(shù)和返回?cái)?shù)據(jù)的處理
這篇文章主要介紹了淺析jQuery Ajax請(qǐng)求參數(shù)和返回?cái)?shù)據(jù)的處理的相關(guān)資料,需要的朋友可以參考下2016-02-02

