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

· 10년 전 · 662

<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년 전 조회 650
9년 전 조회 765
9년 전 조회 681
9년 전 조회 727
9년 전 조회 843
9년 전 조회 623
9년 전 조회 665
9년 전 조회 685
9년 전 조회 805
9년 전 조회 650
9년 전 조회 786
9년 전 조회 567
9년 전 조회 644
9년 전 조회 512
9년 전 조회 707
9년 전 조회 599
9년 전 조회 612
9년 전 조회 665
9년 전 조회 616
9년 전 조회 620
9년 전 조회 606
9년 전 조회 971
9년 전 조회 1,015
9년 전 조회 982
9년 전 조회 950
9년 전 조회 722
9년 전 조회 881
9년 전 조회 1,013
9년 전 조회 716
9년 전 조회 995
9년 전 조회 953
9년 전 조회 1,374
10년 전 조회 983
10년 전 조회 1,165
10년 전 조회 814
10년 전 조회 960
10년 전 조회 690
10년 전 조회 693
10년 전 조회 809
10년 전 조회 772
10년 전 조회 964
10년 전 조회 673
10년 전 조회 737
10년 전 조회 728
10년 전 조회 627
10년 전 조회 729
10년 전 조회 583
10년 전 조회 635
10년 전 조회 565
10년 전 조회 663
10년 전 조회 639
10년 전 조회 1,094
10년 전 조회 602
10년 전 조회 526
10년 전 조회 801
10년 전 조회 634
10년 전 조회 597
10년 전 조회 583
10년 전 조회 545
10년 전 조회 489
10년 전 조회 467
10년 전 조회 541
10년 전 조회 555
10년 전 조회 512
10년 전 조회 454
10년 전 조회 540
10년 전 조회 535
10년 전 조회 522
10년 전 조회 592
10년 전 조회 599
10년 전 조회 483
10년 전 조회 525
10년 전 조회 584
10년 전 조회 523
10년 전 조회 608
10년 전 조회 551
10년 전 조회 493
10년 전 조회 465
10년 전 조회 500
10년 전 조회 485
10년 전 조회 491
10년 전 조회 518
10년 전 조회 455
10년 전 조회 499
10년 전 조회 462
10년 전 조회 568
10년 전 조회 665
10년 전 조회 623
10년 전 조회 583
10년 전 조회 500
10년 전 조회 608
10년 전 조회 510
10년 전 조회 539
10년 전 조회 494
10년 전 조회 475
10년 전 조회 465
10년 전 조회 503
10년 전 조회 571
10년 전 조회 522
10년 전 조회 606