search
HomeWeb Front-endJS TutorialEstablish a good experience Web registration system ajax_javascript skills

*项目名称:具有良好体验度的Web注册系统
*作者:草履虫
*联系:caolvchong@gmail.com
*时间:2007-6-29
*起因和版权说明:
  1.蓝色理想上有位会员发布了个类似的系统,提问说验证码不支持firefox的刷新,于是萌生念头做一个.本系统外观(按钮取色等)借鉴了该系统,但细节实现原理并不相同(该文地址:http://bbs.blueidea.com/thread-2761325-1-4.html).
  2.另外,自己做的这个注册系统中利用了网络上的无组件验证码(作者sipo)
  3.至于密码强度的算法借鉴了蓝色理想的一篇文章(http://www.blueidea.com/tech/web/2006/4324.asp),但该算法并不十分理想,如果有更好算法的朋友不妨交流一下
*特点和知识点:
  1.AJAX验证用户名和验证码,同时异步进行用户名注册(都属于AJAX的很基础部分)
  2.支持验证码刷新(包括firefox平台下)
  3.密码,邮箱,用户名等即时检测(利用javascript DOM)
  4.HTML通过W3C Strict验证,CSS也通过W3C CSS验证(其实这个有点多余,并不完全必要)
*开发平台:Windows2003 IIS6.0 Access数据库
*工具:DreamWeaver(写ASP),Aptana(写Javascript,HTML和CSS),Emeditor(写这篇文章),Access2003(数据库)
*测试平台:Firefox2.0,Opera9.21,IE6.0,IE7.0
*演示地址:http://finish.3322.org/reg/reg.htm(短期有效,在本机上,可能访问不顺畅)
*原文地址:http://cceer.xmu.edu.cn/blog/view.asp?id=52
*补充:
  如果你使用这个注册系统,请务必注意下列问题:
    本系统没有对密码进行加密,如果需要,可以搜索MD5加密
    本系统没有进行防注入设置,如果需要,可以搜索SQL防注入
  限于本人水平上的限制,错误和不足在所难免,如果你有问题或者建议,请联系我,感谢!
*这里是效果图
限于文章长度的限制,只帖出两个js文件和一个显示注册页面,至于后台处理页面以及css文件等,请在压缩包中查看
1.reg.htm(由于BLOG会过滤,分开三个部分写) 
nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 



草履虫---简易AJAX注册页面
  
  <script></script>
  <script></script>




view plaincopy to clipboardprint?
      
  • 草履虫---Web注册系统   
  •   
          
        支持汉字,单词,数字,敏感字符屏蔽  

  •   
          
        密码在6-16位之间,敏感字符屏蔽  

  •   
          
          

  •   
          
        email是联系重要手段  

  • 验证码:   
          
          

  •   
        相关协议:   
              
                
              

  •   
          
          
          

  • 作者:草履虫   
  • 时间:2007-6-28   
  • 联系:caolvchong@gmail.com   
  • Blog---Web2.0之路:http://cceer.xmu.edu.cn/blog/
    /LI>
                                                                   Supports Chinese characters, words, Numbers, sensitive character masking

                                                                                                                                                                                 🎜> Repeat password:

                                                                                              >
Verification code:

🎜>
Can’t see clearly? Please click on the verification code to refresh

Not accepted

                           

                                                                                                                        :http ://cceer.xmu.edu.cn/blog/






2.detect.js view plaincopy to clipboardprint?
var flag= [0,0,0,0,0,0];
var $=function(tagName){
return document.getElementsByTagName(tagName);
} }
//----- -----Accept the agreement
function accept_info(){
flag[0]=1;
check_data();
} }
//--------- -Rejection of the agreement
function refuse_info(){
flag[0]=0;
check_data();
} }
//----------Reset
function reset_info(){
var info=["Support Chinese characters, words, numbers, sensitive character masking", "Password between 6-16 characters, sensitive character masking","","Email is important for contact Means", "Can't see clearly? Please click the verification code to refresh"]                                                                                              ].innerHTML=info[i];
flag[i]=0;
} }
for(var i=0;i                                                                                                         ​
//---------Email detection
function check_email(email){
var reEmail=/^w ([- .]w )*@w ([-.] w )*.w ([-.]w )*$/;
var b_email=reEmail.test(email);
if(b_email){
$("span")[3]. innerHTML="Establish a good experience Web registration system ajax_javascript skills Email is available";                                                                                   $("span")[3].innerHTML ="
Email error"; 
    flag[1]=0;   
    check_data(); Detection
function check_password(obj){
var pwd=$("input")[1].value; Establish a good experience Web registration system ajax_javascript skills var reChinese=/[u0391-uFFE5] /;
var b_chin ese=reChinese. test(pwd);
var reSpace=/s /;
var b_space=reSpace.test(pwd);
//-------Length test
if(pwd.length $("span")[1].innerHTML="
Password length cannot be less than 6";
flag[2]=0;
check_data();
}                                                                                         Contains Chinese "; "
" " flag[2]=0; " "
" " check_data(); " " else if( b_space){
$("span")[1].innerHTML=" Password cannot contain spaces"; Establish a good experience Web registration system ajax_javascript skills flag[2]=0;
check_data();
}
//-------Display password strength when legal      var  msg=new Array("
Password strength is poor", "
Password strength is average", "
Password strength is strong");
if($("input")[2].value!=""){ Establish a good experience Web registration system ajax_javascript skills check_pw(); Establish a good experience Web registration system ajax_javascript skills return flag[2 ]=1; Establish a good experience Web registration system ajax_javascript skills check_data() ; 
                                                                                           var ls =-1;
                                                                                                       { 
   ls ; 
                                                                       🎜> return ls;
}
//---------Password consistency check
function check_pw(){
var pwd=$("input")[1].value.toString();
var check_pwd=$("input")[2].value.toString();
if(flag[2]==1){
if(pwd==check_pwd){
            $( "span")[2].innerHTML="
Password can be used"; 
 flag[3]=1; 
 check_data(); }
else{
$("span")[2].innerHTML="Establish a good experience Web registration system ajax_javascript skills The two passwords are different";
flag[3]=0;
check_data();
                                                                                                                          Judgment                                                                                                                                                                                                                                       var reId=/^[wu0391-uFFE5]                                                        $("span")[0 ].innerHTML="
Illegal ID name"; else{//Legal username uses ajax’s checkid() Check whether it has been registered                                     check_data() {
if(flag[0]==1 && flag[1]==1 && flag[2]==1 && flag[3]==1 && flag[4]==1 && flag[5] ==1){                                                                                                                put")[8].disabled=true;
                                                                                  --------------------------------

var flag=[0,0,0,0, 0,0];
var $=function(tagName){
return document.getElementsByTagName(tagName);
} Establish a good experience Web registration system ajax_javascript skills //----------Accept the agreement
Function accept_info(){
flag[0]=1;
check_data();
}
//----------Reject protocol
function refuse_info( ){
             flag[0]=0;                                                       
//----------Reset
function reset_info(){
var info=["Support Chinese characters, words, numbers, sensitive character masking", "Password in 6- Between 16 bits, sensitive characters are shielded "," "," email is an important means "," Can't see it clearly? Please click the verification code to refresh "]
for (var I = 0; I                                                                    0 ;i                                                                                                      
//----------Email detection
Function check_email(email){ var reEmail=/^w ([- .]w )*@w ([-.] w )*.w ([-.]w )*$/;
var b_email=reEmail.test(email);
if(b_email){
$("span")[3]. innerHTML="Email is available";
                                                                                                 $("span")[3].innerHTML=" Email Error";
                 flag[1]=0;                        Function check_password (obj){
var pwd=$("input")[1].value;
var reChinese=/[u0391-uFFE5] /;
var b_chinese=reChinese.test(pwd);
var reSpace=/s /;
var b_space=reSpace.test(pwd); >               $("span")[1].innerHTML="Password length cannot be less than 6"; >            //--- ----Legality check: cannot contain Chinese characters
else if(b_chinese){
$("span")[1].innerHTML="Password cannot contain Chinese";
flag[2]= 0;
                       check_data();                     
                                                                                                                                                                                                                                                                                                    
          flag[2]=0; else{
                                                                                         The message prompt var num = getResult (pwd);
varm msg = new array )[1].innerHTML=msg[num];
                                                                                            return flag [2]=1;
                        check_data(); function getResult(s ){
var ls =-1;
if (s.match(/[a-z]/ig)){
ls ;
}
                             if (s.match(/[0 -9]/ig)){
                                                                                                                                      >                                                                                                                             
//---------Password consistency check
function check_pw(){
var pwd=$("input")[1].value.toString();
var check_pwd=$("input")[2].value.toString();
if(flag[2]==1){
if(pwd==_pwd){check
               $( "span")[2].innerHTML="Password can be used";
                                                                                🎜>                                                                                                                                                                                         else{ )[2].innerHTML="Two passwords are not the same";
     flag[3]=0; >                                                                                                                                                                                                . -------- username legality detection
Function Check_id (ID_name) {// can only be letters and numbers. Whether the same uses Ajax to judge
var Reid =/^[wu0391-uffe5] $/ ;
var b_id=reId.test(id_name);
if(!b_id){
> flag[4 ]=0;
check_data();
                                                                                                                                                              >                                                                                                                                                                                                                                                                                       =1 && flag[2]==1 && flag[3]==1 && flag[4]==1 && flag[5]==1){
                                                                               =false;
                                      
                else{
                    $("input")[8].disabled=true;
                }
            }

    //--------------------------------------------------------------------
3.ajax.js view plaincopy to clipboardprint?
function checkcode(regcode){       
    var xmlhttp;   
    try{   
        xmlhttp=new XMLHttpRequest();   
        }   
    catch(e){   
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");   
        }   
    xmlhttp.onreadystatechange=function(){   
    if (xmlhttp.readyState==4){   
        if (xmlhttp.status==200){   
            var data=xmlhttp.responseText;   
            code_result(data);   
            }   
        else{   
            $("span")[4].innerHTML="验证码校验失败,请联系管理员";   
            }   
        }   
    else{   
        $("span")[4].innerHTML="正在进行验证码校验...";   
        }   
    }   
    xmlhttp.open("post", "check_code.asp", true);   
    xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
    xmlhttp.send("regcode=" escape(regcode));   
}   
function code_result(data){   
    var resultbox=$("span")[4];   
    if(data==1){   
        resultbox.innerHTML='Establish a good experience Web registration system ajax_javascript skills 验证码正确';   
        flag[5]=1;   
        check_data();   
        }   
    else{   
        resultbox.innerHTML='Establish a good experience Web registration system ajax_javascript skills 验证码错误';   
        flag[5]=0;   
        check_data();   
        }   
}   

//--------------------------------------------------------------------   
function checkid(regid){       
    var xmlhttp;   
    try{   
        xmlhttp=new XMLHttpRequest();   
        }   
    catch(e){   
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");   
        }
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4){
if (xmlhttp.status==200){
var data=xmlhttp.responseText; 🎜> id_result(data);                                                                                                                  🎜> else{
$("span")[0].innerHTML="Username verification in progress...";
else{ }
xmlhttp.open("post", "check_id.asp", true);
xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xmlhttp.send("regid=" escape(regid) );
}
function id_result(data){
var resultbox=$("span")[0];
if(data==1){
resultbox.innerHTML='
Username available';
flag[4]=1;
check_data();
else{
resultbox.innerHTML='
This username has been Register'; 
 flag[4]=0; 
 check_data(); -------------------------------------------------- ---- Establish a good experience Web registration system ajax_javascript skillsfunction sendinfo(regname,pwd,email){
var xmlhttp;
try{ ​​catch(e){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
if (xmlhttp. status==200){
var data=xmlhttp.responseText; Establish a good experience Web registration system ajax_javascript skills reg_result(data);
} }
else{
             $("span")[5].innerHTML="Register Failed, please contact the administrator";
                                      } 
 }
xmlhttp.open("post", "reg.asp", true);
xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xmlhttp .send("regname=" escape(regname) "&pwd=" escape(pwd) "&email=" escape(email));
}
function reg_result(data){
if(data== 1){
$("span")[5].innerHTML='' $("input")[0].value ",Hello. Please click here to log in";
                                                                                                   Download (including all files, pictures, databases, etc., please test under IIS after decompression)

A registration system with good experience.rar
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
JavaScript in Action: Real-World Examples and ProjectsJavaScript in Action: Real-World Examples and ProjectsApr 19, 2025 am 12:13 AM

JavaScript's application in the real world includes front-end and back-end development. 1) Display front-end applications by building a TODO list application, involving DOM operations and event processing. 2) Build RESTfulAPI through Node.js and Express to demonstrate back-end applications.

JavaScript and the Web: Core Functionality and Use CasesJavaScript and the Web: Core Functionality and Use CasesApr 18, 2025 am 12:19 AM

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.

Understanding the JavaScript Engine: Implementation DetailsUnderstanding the JavaScript Engine: Implementation DetailsApr 17, 2025 am 12:05 AM

Understanding how JavaScript engine works internally is important to developers because it helps write more efficient code and understand performance bottlenecks and optimization strategies. 1) The engine's workflow includes three stages: parsing, compiling and execution; 2) During the execution process, the engine will perform dynamic optimization, such as inline cache and hidden classes; 3) Best practices include avoiding global variables, optimizing loops, using const and lets, and avoiding excessive use of closures.

Python vs. JavaScript: The Learning Curve and Ease of UsePython vs. JavaScript: The Learning Curve and Ease of UseApr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

Python vs. JavaScript: Community, Libraries, and ResourcesPython vs. JavaScript: Community, Libraries, and ResourcesApr 15, 2025 am 12:16 AM

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

From C/C   to JavaScript: How It All WorksFrom C/C to JavaScript: How It All WorksApr 14, 2025 am 12:05 AM

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

JavaScript Engines: Comparing ImplementationsJavaScript Engines: Comparing ImplementationsApr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Beyond the Browser: JavaScript in the Real WorldBeyond the Browser: JavaScript in the Real WorldApr 12, 2025 am 12:06 AM

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools