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

· 10년 전 · 709

<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년 전 조회 701
9년 전 조회 807
9년 전 조회 709
9년 전 조회 791
9년 전 조회 894
9년 전 조회 671
9년 전 조회 720
9년 전 조회 726
9년 전 조회 868
9년 전 조회 693
9년 전 조회 826
9년 전 조회 625
9년 전 조회 706
9년 전 조회 552
9년 전 조회 763
9년 전 조회 647
9년 전 조회 669
9년 전 조회 727
9년 전 조회 675
9년 전 조회 685
9년 전 조회 657
9년 전 조회 1,027
9년 전 조회 1,064
9년 전 조회 1,052
9년 전 조회 991
9년 전 조회 781
9년 전 조회 935
9년 전 조회 1,065
9년 전 조회 771
9년 전 조회 1,054
9년 전 조회 1,017
10년 전 조회 1,424
10년 전 조회 1,032
10년 전 조회 1,224
10년 전 조회 852
10년 전 조회 1,015
10년 전 조회 729
10년 전 조회 749
10년 전 조회 875
10년 전 조회 841
10년 전 조회 1,000
10년 전 조회 738
10년 전 조회 801
10년 전 조회 770
10년 전 조회 682
10년 전 조회 791
10년 전 조회 635
10년 전 조회 689
10년 전 조회 618
10년 전 조회 710
10년 전 조회 684
10년 전 조회 1,137
10년 전 조회 659
10년 전 조회 586
10년 전 조회 852
10년 전 조회 670
10년 전 조회 645
10년 전 조회 647
10년 전 조회 597
10년 전 조회 542
10년 전 조회 522
10년 전 조회 597
10년 전 조회 613
10년 전 조회 561
10년 전 조회 510
10년 전 조회 599
10년 전 조회 568
10년 전 조회 577
10년 전 조회 634
10년 전 조회 644
10년 전 조회 537
10년 전 조회 577
10년 전 조회 633
10년 전 조회 576
10년 전 조회 666
10년 전 조회 603
10년 전 조회 546
10년 전 조회 522
10년 전 조회 553
10년 전 조회 511
10년 전 조회 544
10년 전 조회 580
10년 전 조회 514
10년 전 조회 564
10년 전 조회 522
10년 전 조회 615
10년 전 조회 717
10년 전 조회 672
10년 전 조회 649
10년 전 조회 547
10년 전 조회 649
10년 전 조회 563
10년 전 조회 598
10년 전 조회 551
10년 전 조회 535
10년 전 조회 522
10년 전 조회 552
10년 전 조회 631
10년 전 조회 580
10년 전 조회 660