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

· 10년 전 · 716

<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년 전 조회 711
9년 전 조회 814
9년 전 조회 718
9년 전 조회 799
9년 전 조회 906
9년 전 조회 686
9년 전 조회 730
9년 전 조회 739
9년 전 조회 878
9년 전 조회 712
9년 전 조회 839
9년 전 조회 637
9년 전 조회 720
9년 전 조회 568
9년 전 조회 773
9년 전 조회 660
9년 전 조회 678
9년 전 조회 739
9년 전 조회 687
9년 전 조회 699
9년 전 조회 670
9년 전 조회 1,035
9년 전 조회 1,077
9년 전 조회 1,066
9년 전 조회 1,004
9년 전 조회 798
9년 전 조회 952
9년 전 조회 1,075
9년 전 조회 777
9년 전 조회 1,071
10년 전 조회 1,028
10년 전 조회 1,440
10년 전 조회 1,044
10년 전 조회 1,236
10년 전 조회 864
10년 전 조회 1,030
10년 전 조회 738
10년 전 조회 763
10년 전 조회 889
10년 전 조회 855
10년 전 조회 1,010
10년 전 조회 747
10년 전 조회 811
10년 전 조회 781
10년 전 조회 693
10년 전 조회 803
10년 전 조회 647
10년 전 조회 700
10년 전 조회 627
10년 전 조회 717
10년 전 조회 697
10년 전 조회 1,141
10년 전 조회 664
10년 전 조회 596
10년 전 조회 857
10년 전 조회 676
10년 전 조회 650
10년 전 조회 655
10년 전 조회 609
10년 전 조회 553
10년 전 조회 530
10년 전 조회 610
10년 전 조회 625
10년 전 조회 575
10년 전 조회 517
10년 전 조회 605
10년 전 조회 580
10년 전 조회 589
10년 전 조회 644
10년 전 조회 653
10년 전 조회 545
10년 전 조회 585
10년 전 조회 643
10년 전 조회 582
10년 전 조회 669
10년 전 조회 609
10년 전 조회 554
10년 전 조회 531
10년 전 조회 565
10년 전 조회 520
10년 전 조회 551
10년 전 조회 590
10년 전 조회 523
10년 전 조회 570
10년 전 조회 537
10년 전 조회 628
10년 전 조회 730
10년 전 조회 687
10년 전 조회 662
10년 전 조회 557
10년 전 조회 661
10년 전 조회 571
10년 전 조회 604
10년 전 조회 566
10년 전 조회 547
10년 전 조회 532
10년 전 조회 566
10년 전 조회 647
10년 전 조회 595
10년 전 조회 674