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

· 10년 전 · 699

<SCRIPT LANGUAGE="JavaScript">
<!--
function maskHp(obj) {
    var str = obj.value;
    if ( str ) {
        //var pattern = /[^(ㄱ-힣)]|[-/\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년 전 조회 692
9년 전 조회 799
9년 전 조회 706
9년 전 조회 783
9년 전 조회 883
9년 전 조회 661
9년 전 조회 711
9년 전 조회 720
9년 전 조회 853
9년 전 조회 687
9년 전 조회 819
9년 전 조회 618
9년 전 조회 698
9년 전 조회 547
9년 전 조회 758
9년 전 조회 637
9년 전 조회 664
9년 전 조회 719
9년 전 조회 665
9년 전 조회 676
9년 전 조회 645
9년 전 조회 1,020
9년 전 조회 1,056
9년 전 조회 1,044
9년 전 조회 981
9년 전 조회 772
9년 전 조회 928
9년 전 조회 1,056
9년 전 조회 762
9년 전 조회 1,045
9년 전 조회 999
10년 전 조회 1,412
10년 전 조회 1,025
10년 전 조회 1,215
10년 전 조회 844
10년 전 조회 1,001
10년 전 조회 720
10년 전 조회 744
10년 전 조회 864
10년 전 조회 831
10년 전 조회 994
10년 전 조회 728
10년 전 조회 790
10년 전 조회 756
10년 전 조회 676
10년 전 조회 780
10년 전 조회 621
10년 전 조회 682
10년 전 조회 609
10년 전 조회 700
10년 전 조회 677
10년 전 조회 1,127
10년 전 조회 645
10년 전 조회 576
10년 전 조회 844
10년 전 조회 664
10년 전 조회 638
10년 전 조회 635
10년 전 조회 591
10년 전 조회 530
10년 전 조회 515
10년 전 조회 588
10년 전 조회 605
10년 전 조회 556
10년 전 조회 506
10년 전 조회 593
10년 전 조회 556
10년 전 조회 570
10년 전 조회 627
10년 전 조회 634
10년 전 조회 525
10년 전 조회 570
10년 전 조회 627
10년 전 조회 569
10년 전 조회 656
10년 전 조회 595
10년 전 조회 540
10년 전 조회 518
10년 전 조회 546
10년 전 조회 501
10년 전 조회 536
10년 전 조회 570
10년 전 조회 504
10년 전 조회 554
10년 전 조회 510
10년 전 조회 609
10년 전 조회 710
10년 전 조회 660
10년 전 조회 635
10년 전 조회 533
10년 전 조회 636
10년 전 조회 555
10년 전 조회 589
10년 전 조회 545
10년 전 조회 528
10년 전 조회 515
10년 전 조회 546
10년 전 조회 625
10년 전 조회 575
10년 전 조회 653