blurイベントフォーム認証

3569 ワード




    
    Document
    


    
    
function checkUsername(){ var value = document.myform.username.value; var td = document.getElementById('username_info'); if(value.match(/^\w{6,12}$/)=== null){ td.innerHTML = ' 6-12 , , '; td.style.color = 'red'; return false; }else{ td.innerHTML = ' '; td.style.color = 'green'; return true; } } function checkEmail(){ var email = document.myform.username.value; var td = document.getElementById('email_info'); if(email.match(/^[\w-]+@[\w-]+(\.\w+){1,3}$/)=== null){ td.innerHTML = ' '; td.style.color = 'red'; return false; }else{ td.innerHTML = ' '; td.style.color = 'green'; return true; } } function checkPwd(){ var pwd = document.myform.pwd.value; var td = document.getElementById('pwd_info'); if(pwd.length < 6 || pwd.length >18){ td.innerHTML = ' 6-18 '; td.style.color = 'red'; return false; }else{ td.innerHTML = ' '; td.style.color = 'green'; return true; } } function checkpRewd(){ var pwd = document.myform.pwd.value; var repwd = document.myform.repwd.value; var td = document.getElementById('repwd_info'); if(pwd != repwd){ td.innerHTML = ' '; td.style.color = 'red'; return false; }else{ td.innerHTML = ' '; td.style.color = 'green'; return true; } } function checkForm(){ return checkUsername() && checkEmail() && checkPwd() && checkRepwd(); }