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

· 10년 전 · 670

<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년 전 조회 664
9년 전 조회 775
9년 전 조회 688
9년 전 조회 757
9년 전 조회 865
9년 전 조회 637
9년 전 조회 688
9년 전 조회 698
9년 전 조회 821
9년 전 조회 659
9년 전 조회 795
9년 전 조회 592
9년 전 조회 669
9년 전 조회 522
9년 전 조회 731
9년 전 조회 614
9년 전 조회 640
9년 전 조회 689
9년 전 조회 638
9년 전 조회 644
9년 전 조회 619
9년 전 조회 997
9년 전 조회 1,029
9년 전 조회 1,006
9년 전 조회 958
9년 전 조회 744
9년 전 조회 906
9년 전 조회 1,028
9년 전 조회 727
9년 전 조회 1,012
9년 전 조회 972
10년 전 조회 1,388
10년 전 조회 998
10년 전 조회 1,187
10년 전 조회 828
10년 전 조회 976
10년 전 조회 702
10년 전 조회 715
10년 전 조회 825
10년 전 조회 799
10년 전 조회 971
10년 전 조회 693
10년 전 조회 760
10년 전 조회 734
10년 전 조회 645
10년 전 조회 749
10년 전 조회 597
10년 전 조회 650
10년 전 조회 585
10년 전 조회 671
10년 전 조회 655
10년 전 조회 1,110
10년 전 조회 614
10년 전 조회 553
10년 전 조회 815
10년 전 조회 645
10년 전 조회 612
10년 전 조회 603
10년 전 조회 571
10년 전 조회 509
10년 전 조회 489
10년 전 조회 562
10년 전 조회 572
10년 전 조회 528
10년 전 조회 474
10년 전 조회 560
10년 전 조회 538
10년 전 조회 547
10년 전 조회 602
10년 전 조회 609
10년 전 조회 503
10년 전 조회 546
10년 전 조회 603
10년 전 조회 540
10년 전 조회 626
10년 전 조회 566
10년 전 조회 515
10년 전 조회 486
10년 전 조회 516
10년 전 조회 485
10년 전 조회 509
10년 전 조회 542
10년 전 조회 473
10년 전 조회 523
10년 전 조회 484
10년 전 조회 587
10년 전 조회 688
10년 전 조회 636
10년 전 조회 605
10년 전 조회 519
10년 전 조회 618
10년 전 조회 531
10년 전 조회 561
10년 전 조회 518
10년 전 조회 500
10년 전 조회 484
10년 전 조회 525
10년 전 조회 597
10년 전 조회 546
10년 전 조회 624