Naver 회원 가입시 사용하는 자바스크립트 > script

본문 바로가기
사이트 내 전체검색

script

Naver 회원 가입시 사용하는 자바스크립트

페이지 정보

작성자 서방님 댓글 0건 조회 191회 작성일 07-08-08 19:30

본문

<script language="javascript">
<!--
/*---------------------------------------------------------------------------------------------
                                      JAVASCRIPT CODE
  ---------------------------------------------------------------------------------------------
  function name                       | description              | use process
  ---------------------------------------------------------------------------------------------
  isValidDate()                       | 날짜 유효성 확인         | 실명확인,
  isMoreThan14age(socno1, checkYear)  | 14세 이상인지 확인       | 실명확인,
  checkDigit_socno(socno)             | 주민번호 digit 체크      | 실명확인,
  loadRealName( retVal )              | 실명확인 창  loding 함수 | 실명확인,
  submitRealName()                    | 실명확인 submit()        | 실명확인,
  isValidDate( v_year, v_month, v_day)| 유효한 날짜인지 체트
  isMoreThan14age(socno1, checkYear)  | 14세 이상인지 체크
  checkDigit_socno(socno)
  loadRealName( retVal )
  submitRealName()
  letterarcade( )
  checkDuplicateID( id_value )
  use_searchbutton()
  searchAddr()
  isNumeric(s)
  isHangul(s)
  checkSpace( str )
  validID( str )
  validPWD( str )
  validEMAIL( str )
  validNAME( str )
  validENAME( str )
  checkAgeofParent()
  isEmpty( tmplid )
  submitNvReg( tmplid )
  resetNvReg()
  loadMemberJoin14( retVal )
  next(str,order,size)                주민번호 valid check , 자동 다음 폼 이동         by muse 2002.10.11
  checkData(str,order)                Checking form value before action
  isSameID(str,val)                   Comparing ID with PASSWORD
  validRPWD(str,order)         Checking RE_PASSWORD
  validANSWER(str,order)              Checking ANSWER of the QUESTION for the identify
  dupCheckID(str,order)               Checking if DUPCHECK is over
  setEmail(type)                      naver email setting(type=0 : jr, 1 : naver)

  ---------------------------------------------------------------------------------------------*/

 

/* 14세 이상?
   if age >= 14, return Y
   else return N */

function isValidDate( v_year, v_month, v_day)
{
     var today = new Date();
     var d_year = v_year*1;
     var d_month = v_month*1;
     var d_day = v_day*1;

     //alert("isValidDate arg1 : " + v_year + ", arg2 : " + v_month + ", arg3 : " + v_day );
     //alert("isValidDate" + (today.getMonth()*1+1));

     /* 과거 날짜여야 함. */
     if( v_year > today.getYear() )
         return 'N';
     else if( v_year == today.getYear() && v_month*1 > (today.getMonth()*1+1))
         return 'N';
     else if( v_year == today.getYear() && v_month*1 == (today.getMonth()*1+1) && v_day > today.getDate())
         return 'N';

     /* 달별 일 check */
     if( d_month == 1 || d_month == 3 || d_month == 5 || d_month == 7 || d_month == 8 || d_month == 10 || d_month == 12){
         if( d_day > 31 || d_day < 1) return 'N';
     }
     else if(d_month == 4 || d_month == 6 || d_month == 9 || d_month == 11 ){
         if( d_day > 30 || d_day < 1 ) return 'N';
     }
     else if( d_month == 2 )
     {
       if( ((d_year%4) == 0 && (d_year%100)!= 0) || ((d_year%100) == 0 && (d_year%400) == 0) ){
           if( d_day > 29 || d_day < 1 ) return 'N';
       }
       else {
           if( d_day > 28 || d_day < 1 ) return 'N';
       }
     }

     return 'Y';
}

function isMoreThan14age(socno1, checkYear)
{
     var u_year;
     var u_month;
     var u_day;
     var v_age;
     var v_today = new Date();

     /* alert( socno1 + ", " + checkYear); */
     if( checkYear > 0 &&  checkYear < 3)
        u_year = "19" + socno1.substring(0, 2)
     else if(checkYear > 2 &&  checkYear < 5)
        u_year = "20" + socno1.substring(0, 2)
     else return 'wrong';     // 2002.10.8 주민등록뒷자리 첫번째 번호 유효성 체크 (1,2,3,4) are only valid  -- by muse

     u_month = socno1.substring(2, 4);
     u_day = socno1.substring(4);
     /* alert( socno1.substring(0, 2) + "-" + u_year + ", " + u_month + ", " + u_day );        */

     var rVal = isValidDate(u_year, u_month, u_day );
     if( rVal == 'N' ) return 'I';
     else if( rVal == 'Y' ){
         v_age = v_today.getYear()*1 - u_year*1;
         if( u_month*1 > (v_today.getMonth*1+1) ){
             v_age -= 1;
         }
         else if( u_month*1 == (v_today.getMonth()*1+1) && u_day*1 > v_today.getDate()*1 ){
             v_age -= 1;
         }
     }

     if( v_age < 14 ) return 'N';
     else if( v_age >= 14 && v_age < 18 ) return 'M';
     else return 'Y';
}

function checkDigit_socno(socno)
{
 if(socno == "7002271786193") return 'NO';
     var socnoStr = socno.toString();
     a = socnoStr.substring(0, 1);
     b = socnoStr.substring(1, 2);
     c = socnoStr.substring(2, 3);
     d = socnoStr.substring(3, 4);
     e = socnoStr.substring(4, 5);
     f = socnoStr.substring(5, 6);
     g = socnoStr.substring(6, 7);
     h = socnoStr.substring(7, 8);
     i = socnoStr.substring(8, 9);
     j = socnoStr.substring(9, 10);
     k = socnoStr.substring(10, 11);
     l = socnoStr.substring(11, 12);
     m = socnoStr.substring(12, 13);

     temp=a*2+b*3+c*4+d*5+e*6+f*7+g*8+h*9+i*2+j*3+k*4+l*5;
     temp=temp%11;
     temp=11-temp;
     temp=temp%10;

     if(temp == m)
        return 'Y';
     else
        return 'N';
}

function loadRealName( retVal )
{
     if( retVal == 1 ){
         alert( "실명확인이 실패하였습니다. 실명을 입력하세요");
         document.forms[0].r_name.focus();
     }
     else
         document.forms[0].r_name.focus();

     return;
}
function submitRealName()
{
     var thisFrm = document.forms[0];
     //alert(thisFrm.r_name.value);
     //alert(thisFrm.r_socno1.value + "-" + thisFrm.r_socno2.value );

     if( thisFrm.r_name.value == '' ){
       alert("이름을 입력하세요");
       thisFrm.r_name.focus();
       thisFrm.r_name.select();
         return false;
     }
     if( validNAME(thisFrm.r_name.value) == 0){
       thisFrm.r_name.focus();
       thisFrm.r_name.select();
       return false;
     }

     if( thisFrm.r_socno1.value == '' ){
         alert("주민등록번호 앞자리를 입력하세요");
         thisFrm.r_socno1.focus();
         return false;
     }

 if( thisFrm.r_socno1.value.length != 6 ){
         alert("유효한 주민등록번호가 아닙니다");
         thisFrm.r_socno1.focus();
         return false;
     }

     if( thisFrm.r_socno2.value == '' ){
         alert("주민등록번호 뒷자리를 입력하세요");
         thisFrm.r_socno2.focus();
         return false;
     }

 if( thisFrm.r_socno2.value.length != 7){
         alert("유효한 주민등록번호가 아닙니다");
         thisFrm.r_socno2.focus();
         return false;
     }


 var socno = (thisFrm.r_socno1.value + thisFrm.r_socno2.value);
    var rVal1 = checkDigit_socno(socno);
    if( rVal1 == 'N' ){
        alert("주민등록번호가 유효하지 않습니다. 다시 입력하세요");
        thisFrm.r_socno1.focus();
        return false;
    }else if(rVal1 == 'NO'){
  alert("가입이 금지된 사용자입니다.");
        thisFrm.r_socno1.focus();
        return false;
 }

 

 

     var rVal = isMoreThan14age(thisFrm.r_socno1.value, thisFrm.r_socno2.value.substring(0, 1));
//2002.10.8 주민등록뒷번호 첫번째 차리 valid check     --by muse
     if ( rVal == 'wrong' ){
         alert("주민등록번호가 유효하지 않습니다. 다시 입력하세요");
         thisFrm.r_socno2.focus();
         return false;
     }


     /* alert( rVal); */

     if( rVal != 'Y' ){  /* 14세 미만, 14~17세 */
       var socno = (thisFrm.r_socno1.value + thisFrm.r_socno2.value);
         var rVal1 = checkDigit_socno(socno);
             if( rVal1 == 'N' ){
              alert("주민등록번호가 유효하지 않습니다. 다시 입력하세요");
              thisFrm.r_socno1.focus();
              return false;
             }
             else if ( rVal1 == 'Y' ){
    thisFrm.action = "checkRealName.php";
              if( rVal == 'N' ){
        thisFrm.isMoreThan14.value=0;
        thisFrm.isRealName.value=0;
        thisFrm.agelevel.value=0;
              }
              else if( rVal == 'M' ){
        thisFrm.isMoreThan14.value=0;
        thisFrm.isRealName.value=0;
        thisFrm.agelevel.value=1;
          }
              thisFrm.submit();
             }
     }
     else if( rVal == 'Y' ){
         thisFrm.action = "checkRealName.php"; //18세 이상
         thisFrm.isMoreThan14.value=1;
         thisFrm.isRealName.value=0;
         thisFrm.agelevel.value=2;


         thisFrm.submit();
     }


}

/* ----------------------------------------------------------------------------- */
function letterarcade( )
{
     var l_win;

          var template = ("http://ids.naver.com/letterarcade/reg/letterarcade.php" );
          l_win = window.open( template, "LetterArcade", "scrollbars=yes, width=620, height=650");
}
function showletter()
{
         alert("lcodeD4:" + document.forms[0].lcodeD4.value + ", " +
               "lcodeC2:" + document.forms[0].lcodeC2.value + ", " +
               "lcodeC3:" + document.forms[0].lcodeC3.value + ", " +
               "lcodeC4:" + document.forms[0].lcodeC4.value + ", " +
               "lcodeA1:" + document.forms[0].lcodeA1.value + ", " +
               "lcodeE1:" + document.forms[0].lcodeE1.value + ", " +
               "lcodeE2:" + document.forms[0].lcodeE2.value + ", " +
               "lcodeE3:" + document.forms[0].lcodeE3.value + ", " +
               "lcodeJ1:" + document.forms[0].lcodeJ1.value + ", " +
               "lcodeD2:" + document.forms[0].lcodeD2.value + ", " +
               "lcodeD3:" + document.forms[0].lcodeD3.value + ", " +
               "lcodeD1:" + document.forms[0].lcodeD1.value + ", " +
               "lcodeC5:" + document.forms[0].lcodeC5.value + ", " +
               "lcodeC6:" + document.forms[0].lcodeC6.value + ", " +
               "lcodeC7:" + document.forms[0].lcodeC7.value + ", " +
               "lcodeC1:" + document.forms[0].lcodeC1.value + ", " +
               "lcodeF1:" + document.forms[0].lcodeF1.value + ", " +
               "lcodeB1:" + document.forms[0].lcodeB1.value ) ;
}
 /*-----------------------------------------------------------------------------*/

function  checkDuplicateID( id_value )
{
     var cWin;
     /*
     alert(id_value);
     alert("AAA");
     */
     if( !id_value ){
         alert("아이디를 입력하시오");
         document.forms[0].id.focus();
     }
     else{
       retVal = validID(id_value);
         if( !retVal ) {
          document.forms[0].id.focus();
            return;
         }

          var template = ("http://ids.naver.com/dupcheck/check_dupid.php?id=" + id_value );
          cWin = window.open( template, "checkDuplicateID", "status=no, resizable=yes, width=401, height=303" );
     }
}
function use_searchbutton()
{
     document.forms[0].addr2.focus();
     searchAddr();
     return;
}

function searchAddr()
{
     window.open("http://ids.naver.com/searchaddr/address.php","address","width=550,height=380,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
}

function isNumeric(s)
{
     var isNum = /d/;
     if( !isNum.test(s) ) return 0;
     return 1;
}
function isNumer(s)
{
     var isNum = /^[d]+$/;
     if( s.search(isNum) ) return 0;
     return 1;
}

function isHangul(s)
{
     var len;

     len = s.length;

     for (var i = 0; i < len; i++)  {
         if (s.charCodeAt(i) != 32 && (s.charCodeAt(i) < 44032 || s.charCodeAt(i) > 55203))
             return 0;
     }
     return 1;
}

function checkSpace( str )
{
     if(str.search(/s/) != -1){
      return 1;
     }

     else {
         return "";
     }
}
function validID( str )
{
     /* check whether input value is included space or not  */
     if( str == ""){
      alert("아이디를 입력하세요.");
      return 0;
     }

     var retVal = checkSpace( str );

     if( retVal != "" ) {
         alert("아이디는 빈 공간 없이 연속된 영문 소문자와 숫자만 사용할 수 있습니다.");
         return 0;
     }
     if( str.charAt(0) == '_') {
  alert("아이디의 첫문자는 '_'로 시작할수 없습니다.");
  return 0;
     }

     /* checkFormat  */
     var isID = /^[a-z0-9_]{3,12}$/;
     if( !isID.test(str) ) {
         alert("아이디는 3~12자의 영문 소문자와 숫자,특수기호(_)만 사용할 수 있습니다.");
         return 0;
     }
     return 1;
}

function validPWD( str )
{
     var cnt=0;
     if( str == ""){
      alert("비밀번호를 입력하세요.");
      return 0;
     }

    /* check whether input value is included space or not  */
     var retVal = checkSpace( str );
     if( retVal != "") {
         alert("비밀번호는 빈공간 없이 연속된 영문 소문자와 숫자만 사용할 수 있습니다.");
         return 0;
     }
     for( var i=0; i < str.length; ++i)
     {
         if( str.charAt(0) == str.substring( i, i+1 ) ) ++cnt;
     }
     if( cnt == str.length ) {
         alert("보안상의 이유로 한 문자로 연속된 비밀번호는 허용하지 않습니다.");
         return 0;
     }

     /* limitLength */

     //var isPW = /^[a-z0-9_~`!@\#$%^&*()-+=|[]{};:'"<,>.?/]{6,12}$/;
     var isPW = /^[a-z0-9]{6,12}$/;
     if( !isPW.test(str) ) {
         alert("비밀번호는 6~12자의 영문 소문자와 숫자만 사용할 수 있습니다.");
         return 0;
     }
     return 1;
}

function validEMAIL( str )
{
     /* check whether input value is included space or not  */
     if(str == ""){
      alert("이메일 주소를 입력하세요.");
      return 0;
     }
     var retVal = checkSpace( str );
     if( retVal != "") {
         alert("이메일 주소를 빈공간 없이 넣으세요.");
         return 0;
     }

     /* checkFormat */
     var isEmail = /[-!#$%&'*+/^_~{}|0-9a-zA-Z]+(.[-!#$%&'*+/^_~{}|0-9a-zA-Z]+)*@[-!#$%&'*+/^_~{}|0-9a-zA-Z]+(.[-!#$%&'*+/^_~{}|0-9a-zA-Z]+)*/;
     if( !isEmail.test(str) ) {
         alert("이메일 형식이 잘못 되었습니다.");
         return 0;
     }
     if( str.length > 60 ) {
         alert("이메일 주소는 60자까지 유효합니다.");
         return 0;
     }
/*
  if( str.lastIndexOf("daum.net") >= 0 || str.lastIndexOf("hanmail.net") >= 0 ) {
    alert("다음 메일 계정은 사용하실 수 없습니다.");
   document.forms[0].email.focus();
   return 0;
  }
*/

     return 1;
}

function validNAME(str)
{

     if( str == '' ){
       alert("이름을 입력하세요");
         return 0;
     }

     var retVal = checkSpace( str );
     if( retVal != ""){
         alert("이름은 띄어쓰기 없이 입력하세요.");
         return 0;
     }
     if( !isHangul(str) ) {
         alert("이름을 한글로 입력하세요.");
         return 0;
     }
     if( str.length > 7 ) {
         alert("이름은 7자까지만 사용할 수 있습니다.");
         return 0;
     }
     return 1;
}

function validENAME( str )
{
              /* check format */
     var isENAME = /^w/gi;

     if( !isENAME.test( str ) )
     {
         alert("영문이름을 입력하세요");
         document.forms[0].ename1.select();
         return 0;
     }
     return 1;

}

function checkAgeofParent()
   {
       var thisFrm = document.forms[0];
       var birth_year;
       var birth_month;
       var birth_day;
       var today = new Date();

     /* current date */
       var cyear = today.getYear();
       var cmonth = today.getMonth();
       var cday = today.getDate();
       cmonth = (cmonth*1)+1;

     /* analyze socail numer */
       sevenChr = thisFrm.psocno2.value.substring(0,1);
       if( sevenChr == "1" || sevenChr == "2" )
       {
           birth_year = ( "19" + thisFrm.psocno1.value.substring(0,2) );
       }
       else if( sevenChr == "3" || sevenChr == "4" )
       {
           birth_year = ( "20" + thisFrm.psocno1.value.substring(0,2) );
       }
       else
       {
            alert("유효하지 않은 주민등록번호 입니다.");
            return 0;
       }


       birth_month = thisFrm.psocno1.value.substring(2,4);
       birth_month = (birth_month*1);
       if( birth_month < 1 || birth_month > 12 )
       {
            alert("유효하지 않은 주민등록번호 입니다.");
            return 0;
       }


       birth_day = thisFrm.psocno1.value.substring(4,6);
       birth_day = (birth_day*1);
       if( birth_day < 1 || birth_day > 31 )
       {
            alert("유효하지 않은 주민등록번호 입니다.");
            return 0;
       }

       age = (cyear*1) - birth_year;
       amonth = cmonth - birth_month;

       if( amonth < 0 )
       {
           age = age-1;
       }
       else if( amonth == 0 )
       {
             aday = (cday*1) - birth_day;
             if( aday < 0 )
             {
                  age = age-1;
             }
       }

       if( age < 0 )
       {
            alert("유효하지 않은 주민등록번호 입니다.");
            return 0;
       }
       else if( age < 19 )
       {
            alert("부모님(법정보호자)의 주민등록번호를 입력하세요.")
            return 0;
       }
       return 1;

   }

function isEmpty(tmplid)
{
     var thisFrm = document.forms[0];
     var retVal;


     if( thisFrm.id.value == "" ) {
         alert("아이디를 입력하세요.");
         thisFrm.id.focus();
         return 0;
     }
     else {
       retVal = validID(thisFrm.id.value);
         if( !retVal ) {
             thisFrm.id.select();
             thisFrm.id.focus();
             return 0;
         }
     }
     if( thisFrm.pwd.value == "" ) {
         alert("비밀번호를 입력하세요.");
         thisFrm.pwd.focus();
         return 0;
     }
     else {
         retVal = validPWD(thisFrm.pwd.value);
         if( !retVal ) {
             thisFrm.pwd.select();
             thisFrm.pwd.focus();
             return 0;
         }
     }
     if( thisFrm.re_pwd.value == "" ) {
         alert("비밀번호 확인을 입력하세요.");
         thisFrm.re_pwd.focus();
         return 0;
     }
     else {
         retVal = validPWD(thisFrm.re_pwd.value);
         if( !retVal ) return 0;
     }
     if( thisFrm.pwd.value != thisFrm.re_pwd.value ) {
         alert("비밀번호가 일치하지 않습니다.");
         thisFrm.pwd.select();
         return 0;
     }
     if( thisFrm.id.value == thisFrm.pwd.value ) {
         alert("아이디와 비밀번호가 같습니다.n보안 상의 이유로 아이디와 같은 비밀버호는 허용하지 않습니다.");
         thisFrm.pwd.select();
         thisFrm.pwd.focus();
         return 0;
     }
     if( thisFrm.rmdq.options[thisFrm.rmdq.selectedIndex].value == 0 ) {
         alert("비밀번호 재발급을 위한 질문을 선택하세요.");
         thisFrm.rmdq.focus();
         return 0;
     }
     if( thisFrm.rmda.value == "" ) {
         alert("비밀번호 재발급을 위한 답을 입력하세요.");
         thisFrm.rmda.focus();
         return 0;
     }
     if( thisFrm.email.value == "" ) {
         alert("이메일 주소를 입력하세요.");
         thisFrm.email.focus();
         return 0;
     }
     else {
         retVal = validEMAIL( thisFrm.email.value );
         if( !retVal ) {
             thisFrm.email.select();
             thisFrm.email.focus();
             return 0;
         }
     }
if( tmplid == 0 )
     {
       if( thisFrm.pname.value == "") {
             alert("부모님 이름을 입력하세요.");
             thisFrm.pname.select();
             return 0;
         }
         else {
             retVal = validNAME( thisFrm.pname.value );
             if( !retVal ) {
                 thisFrm.pname.select();
                 thisFrm.pname.focus();
                 return 0;
             }
         }
         if( thisFrm.psocno1.value == "") {
             alert("부모님 주민등록번호를 입력하세요.");
             thisFrm.psocno1.select();
             return 0;
         }
         /*
         else {
             retVal = validSOCNO1( thisFrm.psocno1.value );
             if( !retVal ) {
                 thisFrm.psocno1.select();
                 thisFrm.psocno1.focus();
                 return 0;
             }
         }
         */
         if( thisFrm.psocno2.value == "") {
             alert("부모님 주민등록번호를 입력하세요.");
             thisFrm.psocno2.select();
             return 0;
         }
         /*
         else {
             retVal = validSOCNO2( thisFrm.psocno1.value, thisFrm.psocno2.value );
             if( !retVal ) {
                 thisFrm.psocno2.select();
                 thisFrm.psocno2.focus();
                 return 0;
             }
         }
         */
         if( thisFrm.pemail.value == "") {
             alert("부모님 이메일 주소를 입력하세요.");
             thisFrm.pemail.select();
             return 0;
         }
         else {
             retVal = validEMAIL( thisFrm.pemail.value );
             if( !retVal ) {
                 thisFrm.pemail.select();
                 thisFrm.pemail.focus();
                 return 0;
             }
         }
}

     if( thisFrm.autoValue.value == "" ) {
         alert("자동가입방지번호를 입력하세요.");
         thisFrm.autoValue.focus();
         return 0;
     }

 

     return 1;
}

/* ================================================
 Final checking form value
   ================================================ */
function submitNvReg(tmplid)
{
     var theFrm = document.forms[0];
     retVal = isEmpty(tmplid);
     if( retVal ) {
      theFrm.action = "insertDB.php";
        theFrm.submit();
        return;
     }
     return;
}

function submitNvReg_test( tmplid )
{
     var retVal ;
     var theFrm = document.forms[0];

     if( tmplid == 0 ){   /* 14세 미만 */
          retVal = isEmpty( tmplid );
          if( retVal ) {
              theFrm.action = "/register/nv/member_join.php";
              theFrm.submit();
              return;
          }
     }
     else if( tmplid == 1 ){
        retVal = isEmpty( tmplid );
          if( retVal ) {
              theFrm.action = "/register/nv/member_join_letter.php";
              theFrm.submit();
              return;
          }
     }
     return;
}
function resetNvReg()
{
     document.forms[0].reset();

}

function loadMemberJoin14( retVal )
{
     if( retVal == 1 ){
         alert( "부모님 실명확인이 실패하였습니다. 실명을 입력하세요");
         document.forms[0].id.focus();
     }
     else
         document.forms[0].id.focus();

     return;
}


function next(str,order,size){     // 주민번호 valid check , 자동 다음 폼 이동

   nex = order + 1;
   num = str.elements[order].value;
   siz = num.length;
   numFlag = Number(num);
   if(!numFlag && siz > 1 && num != '00' &&  num != '000'){
         alert('숫자를 넣어주세요');
         str.elements[order].select();
         str.elements[order].focus();
         return false;
   }

   if(siz == size){
      if( order == 1) str.elements[nex].focus();
   return true;
   }
   if(order == 2 && siz == 1){
  if(num < 1 || num > 4){
   alert('잘못된 주민번호 형식입니다');
          str.elements[order].select();
          str.elements[order].focus();
   return false;
  }
   }
}

function checkSocno1(){     // 주민번호 valid check , 자동 다음 폼 이동 in the upgrade.php
   str = upgradeFrm;
   num = str.socno1.value;
   siz = num.length;
   numFlag = Number(num);
   if(!numFlag && siz > 1 && num != '00' &&  num != '000'){
         alert('숫자를 넣어주세요');
         str.socno1.select();
         str.socno1.focus();
         return;
   }
   if(siz == 6){
      str.socno2.focus();
      return;
   }

}

function checkSocno2(){     // 주민번호 valid check , 자동 다음 폼 이동 in the upgrade.php
   str = upgradeFrm;
   num = str.socno2.value;
   siz = num.length;
   numFlag = Number(num);
   if(!numFlag && siz > 1 && num != '00' &&  num != '000'){
         alert('숫자를 넣어주세요');
         str.socno2.select();
         str.socno2.focus();
         return;
   }
   if(siz == 1){
 if(num < 1 || num > 4){
  alert('잘못된 주민번호 형식입니다');
          str.socno2.select();
          str.socno2.focus();
  return;
 }
   }

}

function next1(str,order,size){     // 부모 주민번호 valid check , 자동 다음 폼 이동

   nex = order + 1;
   num = str.elements[order].value;
   siz = num.length;
   numFlag = Number(num);
   if(!numFlag && siz > 1 && num != '00' &&  num != '000'){
         alert('숫자를 넣어주세요');
         str.elements[order].select();
         str.elements[order].focus();
         return false;
   }

   if(order == 8 && siz == 1){
  if(num < 1 || num > 4){
   alert('잘못된 주민번호 형식입니다');
          str.elements[order].select();
          str.elements[order].focus();
   return false;
  }
   }
   if(siz == size){
      chVal[order] = 1;
      str.elements[nex].focus();
      return true;
   }
}

 

 


function checkName(str,order){

 val = str.elements[order].value;

//아이디 체크
 if(order == 0){

  if(validNAME(val)){
   str.elements[order+1].select();
   str.elements[order+1].focus();

  }else{
   str.elements[order].select();
   str.elements[order].focus();
   return false;
  }

 }
 return true;
}

 

 

 

chVal = new Array(0,0,0,0,0,0,0,0,0);

function checkData(str,order){
 checkID = str.flag.value;

 val = str.elements[order].value;
 next = order + 1;
 pre = order - 1;


//아이디 체크
 if(order == 0){

  if(validID(val)){
   chVal[0] = 1;
  }else{
   str.elements[order].select();
   str.elements[order].focus();
   return false;
  }

 }

 


//비번 체크
 if(order == 1){
  if(checkID == 0) return false;
  if(str.elements[pre].value == '') return false;
  if(chVal[0] == 0) return false;
  if(validPWD(val) && isSameID(str,val)){
   str.elements[next].readOnly = false;
   str.elements[next].select();
   str.elements[next].focus();
   chVal[1] = 1;

  }else{
   str.elements[order].select();
   str.elements[order].focus();
   return false;


  }

 }

//비번 재체크
 if(order == 2){
  if(checkID == 0) return false;
  if(str.elements[pre].value == '') return false;
  if(chVal[1] == 0) return false;
                tag = validRPWD(str,order);
  if(tag == -1){
   str.elements[order].select();
   str.elements[order].focus();
   return false;
  }else if(tag == 0){
   str.elements[order].value = "";
   str.elements[pre].value = "";
   chVal[1] = 0;
   str.elements[pre].select();
   str.elements[pre].focus();
   return false;

  }else{
   str.elements[next].disabled = false;
   str.elements[next].focus();
   chVal[2] = 1;

  }

 }
// 질문 체크
 if(order == 3){

  str.elements[next].readOnly = false;
  str.elements[next].focus();
  str.elements[next].select();

 }

//답변 체크

 if(order == 4){
  if(checkID == 0) return false;
  if(str.elements[pre-1].value == "") return false;
  if(chVal[2] == 0) return false;
  if(validANSWER(str,order)){
   str.elements[next].readOnly = false;
   str.elements[next].select();
   str.elements[next].focus();
   chVal[4] = 1;

  }else{
   str.elements[order].focus();
   str.elements[order].select();
   return false;

  }

 }

 

//이메일 체크

 if(order == 5){
  if(checkID == 0) return false;
  if(str.elements[pre].value == '') return false;
  if(chVal[4] == 0) return false;
  if(validEMAIL(val)){
   chVal[5] = 1;
  }else{
   str.elements[order].select();
   str.elements[order].focus();
   return false;

  }
 }

//부모 이름 확인
 if(order == 9){
  if(checkID == 0) return false;
  if(str.elements[pre-3].value == '') return false;
  if(chVal[5] == 0) return false;
  if(validNAME(val)){
   str.elements[next].select();
   str.elements[next].focus();
   chVal[6] = 1;
  }else{
   str.elements[order].select();
   str.elements[order].focus();
   return false;
  }
 }
//주민번호1

 if(order == 10){
  if(checkID == 0) return false;
  if(str.elements[pre].value == '') return false;
  if(chVal[6] == 0) return false;
  return true;
 }
//주민번호2

 if(order == 11){
  if(checkID == 0) return false;
  if(str.elements[pre].value == '') return false;
  if(chVal[7] == 0) return false;
  return true;
 }

//부모 이메일 체크

 if(order == 12){
  if(checkID == 0) return false;
  if(str.elements[pre].value == '') return false;
  if(chVal[8] == 0) return false;
  if(validEMAIL(val)){
  }else{
   str.elements[order].select();
   str.elements[order].focus();
   return false;

  }
 }

 


 return true;
}

 

 

 

function isSameID(str,val){
 IDval = str.elements[0].value;
        if(val == IDval){
                alert("아이디와 비밀번호가 같습니다.n보안 상의 이유로 아이디와 같은 비밀번호는 허용하지 않습니다.");
  return false;
 }else{
   return true;
 }
}

function validRPWD(str,order){
 val = str.elements[order].value;
 if(val == ""){
  alert("비밀번호 확인을 입력하세요.");
  return -1;
 }
 preVal = str.elements[order-1].value;
        if(val != preVal){
  alert('비밀번호가 일치하지 않습니다');
  return 0
 }
  return 1;
}
function validANSWER(str,order){
 val = str.elements[order].value;
      var retVal = checkSpace( val );

      if( retVal != ""){
          alert("대답은 띄어쓰기 없이 입력하세요.");
           return false;
      }


        if(val == ""){
  alert("비밀번호 재발급을 위한 답을 입력하세요.");
  return false;
 }else{
   return true;
 }
}

 


function dupCheckID(str,order){
 checkID = str.flag.value;
 if(chVal[0] == 1 && checkID == 0){
   alert("ID 중복체크를 하시오");
   if(order == 6 || order == 7 || order == 8 || order == 9) str.elements[order].blur();

 }
 if(chVal[0] && chVal[1] && chVal[2] && chVal[4] == 0 && order == 5){
  alert("비밀번호 재발급을 위한 답을 입력하세요.");
  str.elements[order-1].focus();
  str.elements[order-1].select();

 }

}

function submitLetter(){
 document.forms[0].action = "insertLetter.php";
 document.forms[0].submit();
}
function resetLetter(){
 document.forms[0].reset();
 document.forms[0].lcodeD4.checked = false;
 document.forms[0].lcodeA1.checked = false;
 document.forms[0].lcodeJ1.checked = false;
 document.forms[0].lcodeD1.checked = false;
 document.forms[0].lcodeF1.checked = false;
 document.forms[0].lcodeB1.checked = false;
 return;
}

function resetLetterMod(){
    document.forms[0].reset();
    return;
}

 

 

function submitNvMod(){
      thisFrm = document.forms[0];
      rmdaVal = thisFrm.rmda.value;
      if(rmdaVal == ""){
          alert("대답을 입력하세요.");
          thisFrm.rmda.focus();
          thisFrm.rmda.select();
          return;
      }

      retVal = checkSpace(rmdaVal);
      if( retVal != ""){
          alert("대답은 띄어쓰기 없이 입력하세요.");
          thisFrm.rmda.focus();
          thisFrm.rmda.select();
           return;
      }

      emailVal = validEMAIL(thisFrm.email.value);
      if(!emailVal){
          thisFrm.email.focus();
          thisFrm.email.select();
           return;

      }

      thisFrm.action = "updateUserInfo.php";
      thisFrm.submit();

}

function submitModPwd(){
      thisFrm = document.forms[0];
      pVal = thisFrm.pwd.value;
   np1Val = thisFrm.new_pwd1.value;
   np2Val = thisFrm.new_pwd2.value;

      if(!validPWD(np1Val)){
             thisFrm.new_pwd1.focus();
             thisFrm.new_pwd1.select();
             return;
      }
      if(validRPWD(thisFrm,2) != 1){
    thisFrm.new_pwd1.value = "";
    thisFrm.new_pwd2.value = "";
             thisFrm.new_pwd1.focus();
             thisFrm.new_pwd1.select();
             return;
      }
      thisFrm.action = "updatePass.php";
      thisFrm.submit();

}

function submitLetterMod(){
      thisFrm = document.forms[0];
   thisFrm.action = "updateLetter.php";
      thisFrm.submit();
}

 function setEmail(type){
    if(type == 0) tail = "@jr.naver.com";
    else tail = "@naver.com";
    if(registerFrm.mailcheck.checked){
        if(registerFrm.id.value != ""){
            registerFrm.email.value = registerFrm.id.value + tail;
        }else{
            alert('아이디를 입력해주세요');
            registerFrm.mailcheck.checked = false;
            registerFrm.id.focus();
            return 0;
        }
    }else{
        registerFrm.email.value = "";
    }
 }

 

//-->
</script>

댓글목록

등록된 댓글이 없습니다.

Total 846건 34 페이지
게시물 검색

회원로그인

접속자집계

오늘
64
어제
302
최대
1,347
전체
155,125
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.