>  기사  >  웹 프론트엔드  >  jQuery Real Person 확인 코드 플러그인으로 인해 양식이 자동으로 제출되지 않습니다._jquery

jQuery Real Person 확인 코드 플러그인으로 인해 양식이 자동으로 제출되지 않습니다._jquery

WBOY
WBOY원래의
2016-05-16 15:33:271188검색

이 글에서 소개하는 jQuery 플러그인은 조금 특별합니다. 자동 양식 제출 방지를 위한 검증 도구는 우리가 자주 사용하는 검증 코드 도구입니다.

렌더링은 다음과 같습니다.


사용 지침
jQuery 라이브러리 파일과 Real Person 라이브러리 파일을 사용해야 합니다
동시에 인증 코드 표시를 위한 CSS 스타일을 맞춤설정해야 합니다

사용예

1. 파일 부분
eb5ed3af5a776cc458426ea330eea2582cacc6d41bbb37262a98f745aa00fbf0
c08ed8948cb0aed87ccdc679547de9352cacc6d41bbb37262a98f745aa00fbf0
080b747a20f9163200dd0a7d304ba388@import "jquery.realperson.css";531ac245ce3e4fe3d50054a55f265927
2. HTML 부분
1de88d460a79b8e93c04f2361990d30b
3. 자바스크립트 부분
$("#biuuu").realperson();
위의 예와 같이 자동 양식 제출을 방지하는 인증 코드 도구를 구현할 수 있으며 동시에 다음과 같이 인증 코드 문자 길이를 지정할 수 있습니다.
$("#biuuu").realperson({길이: 5});

오늘 이야기한 jQuery Real Person Plugin은 완전히 JavaScript로 작성된 jQuery 확인 코드 플러그인입니다.

jQuery 플러그인 Real Person 예시 설명을 새로 고치려면 클릭하세요

<!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>  

참고: 인증에 계속 실패하는 경우 다음 방법을 시도해 보세요.

<&#63;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; 
} 
&#63;>  

을 다음으로 교체:

<&#63; 
  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" &#63; bindec($binary) : -(pow(2, 31) - bindec(substr($binary, 1))));  
  } 
&#63;> 

위 내용은 jQuery 인증코드 플러그인 Real Person 사용법에 대한 소개입니다. 편집자가 포괄적으로 컴파일하지 않았을 수도 있으니 이해해 주시기 바랍니다.

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.