휴대폰번호 검사 하기 입니다.

· 9년 전 · 538

<SCRIPT LANGUAGE="JavaScript">
<!--
function maskHp(obj) {
    var str = obj.value;
    if ( str ) {
        //var pattern = /[^(ㄱ-&#55203;)]|[-/\s]/g;
        var RegNotNum  = /[\D]/g;
        var pattern = "";
        var format   = "";

        // delete not number ㅋ
        str = str.replace(RegNotNum,'');

        //if( str.length < 4 ) return str;
        if( str.length < 4 ) {
            if( str.length == 3 ) {
                format = "$1";
                pattern = /(^01[\d]{0,1})/;
            } else {
                format = "$1";
                pattern = /(^0[1]?[\d]{0,1})/;
            }
        } else if( str.length > 3 && str.length < 7 ) {
            format = "$1-$2";
            pattern = /(^01[\d]{1})([\d]+)/;
        } else if(str.length == 7 ) {
            format = "$1-$2";
            pattern = /(^01[\d]{1})([\d]{4})/;
        } else {
            format = "$1-$2-$3";
            pattern = /(^01[\d]{1})([\d]{4})([\d]+)/;
        }

        //while( pattern.test(str) ) {
        if ( pattern.test(str) ) {
            obj.value = str.replace(pattern, format);
        } else {
            obj.value = "";
        }
    }
}


function isHpFormat() {
  var str = window.event.srcElement.value;
  //alert ( str );
  if ( window.event.propertyName == "value" && str ) {
        var pattern = "";
        str = str.replace(/[\D]/g,'');
        if( str.length < 4 ) {
            if( str.length == 3 ) pattern = /(^01[\d]{1})/;
            else                  pattern = /(^0[1]?[\d]{0,1})/;
        } else if( str.length > 3 && str.length < 7 ) {
            pattern = /(^01[\d]{1})([\d]+)$/;
        } else if(str.length == 7 ) {
            pattern = /(^01[\d]{1})([\d]{4})/;
        } else {
            pattern = /(^01[\d]{1})([\d]{4})([\d]+)/;
        }
        if ( pattern.test(str) ) {
            return true;
        } else {
            return false;
        }
  } else {
        return true;
      // undefined
  }
}

//-->
</SCRIPT>
<input type='text' id='phon_num' value=''
size='14' maxlength='13'
onpropertychange='if(!isHpFormat()){alert("핸드폰 번호가 정확히 입력해주세요.");this.value="";}'
onkeyup ='maskHp(this);'
onkeydown='maskHp(this);'  >
 

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

프로그램

+
제목 글쓴이 날짜 조회
9년 전 조회 525
9년 전 조회 630
9년 전 조회 556
9년 전 조회 625
9년 전 조회 721
9년 전 조회 502
9년 전 조회 562
9년 전 조회 558
9년 전 조회 701
9년 전 조회 524
9년 전 조회 648
9년 전 조회 476
9년 전 조회 538
9년 전 조회 418
9년 전 조회 618
9년 전 조회 503
9년 전 조회 509
9년 전 조회 559
9년 전 조회 516
9년 전 조회 520
9년 전 조회 484
9년 전 조회 868
9년 전 조회 906
9년 전 조회 888
9년 전 조회 816
9년 전 조회 604
9년 전 조회 777
9년 전 조회 901
9년 전 조회 595
9년 전 조회 891
9년 전 조회 845
9년 전 조회 1,244
9년 전 조회 860
9년 전 조회 1,046
9년 전 조회 695
9년 전 조회 839
9년 전 조회 590
9년 전 조회 577
9년 전 조회 701
9년 전 조회 668
9년 전 조회 852
9년 전 조회 567
9년 전 조회 651
9년 전 조회 599
9년 전 조회 531
9년 전 조회 621
9년 전 조회 479
9년 전 조회 518
9년 전 조회 470
9년 전 조회 539
9년 전 조회 525
9년 전 조회 971
9년 전 조회 493
9년 전 조회 423
9년 전 조회 680
9년 전 조회 502
9년 전 조회 497
9년 전 조회 472
9년 전 조회 438
9년 전 조회 389
9년 전 조회 364
9년 전 조회 438
9년 전 조회 451
9년 전 조회 406
9년 전 조회 345
9년 전 조회 438
9년 전 조회 393
9년 전 조회 418
9년 전 조회 453
9년 전 조회 479
9년 전 조회 363
9년 전 조회 411
9년 전 조회 471
9년 전 조회 402
9년 전 조회 514
9년 전 조회 446
9년 전 조회 381
9년 전 조회 344
9년 전 조회 397
9년 전 조회 347
9년 전 조회 380
9년 전 조회 406
9년 전 조회 340
9년 전 조회 389
9년 전 조회 359
9년 전 조회 457
9년 전 조회 558
10년 전 조회 513
10년 전 조회 466
10년 전 조회 393
10년 전 조회 480
10년 전 조회 408
10년 전 조회 437
10년 전 조회 385
10년 전 조회 363
10년 전 조회 360
10년 전 조회 392
10년 전 조회 464
10년 전 조회 421
10년 전 조회 477
🐛 버그신고