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

· 10년 전 · 667

<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년 전 조회 655
9년 전 조회 767
9년 전 조회 683
9년 전 조회 742
9년 전 조회 854
9년 전 조회 628
9년 전 조회 673
9년 전 조회 692
9년 전 조회 811
9년 전 조회 654
9년 전 조회 788
9년 전 조회 577
9년 전 조회 655
9년 전 조회 520
9년 전 조회 718
9년 전 조회 607
9년 전 조회 628
9년 전 조회 677
9년 전 조회 630
9년 전 조회 629
9년 전 조회 610
9년 전 조회 982
9년 전 조회 1,021
9년 전 조회 995
9년 전 조회 953
9년 전 조회 733
9년 전 조회 891
9년 전 조회 1,016
9년 전 조회 720
9년 전 조회 1,004
9년 전 조회 957
10년 전 조회 1,379
10년 전 조회 990
10년 전 조회 1,176
10년 전 조회 818
10년 전 조회 965
10년 전 조회 698
10년 전 조회 707
10년 전 조회 814
10년 전 조회 786
10년 전 조회 965
10년 전 조회 680
10년 전 조회 750
10년 전 조회 730
10년 전 조회 635
10년 전 조회 734
10년 전 조회 591
10년 전 조회 641
10년 전 조회 576
10년 전 조회 668
10년 전 조회 646
10년 전 조회 1,101
10년 전 조회 608
10년 전 조회 538
10년 전 조회 805
10년 전 조회 637
10년 전 조회 604
10년 전 조회 590
10년 전 조회 560
10년 전 조회 498
10년 전 조회 478
10년 전 조회 549
10년 전 조회 564
10년 전 조회 518
10년 전 조회 463
10년 전 조회 550
10년 전 조회 536
10년 전 조회 531
10년 전 조회 598
10년 전 조회 601
10년 전 조회 494
10년 전 조회 530
10년 전 조회 591
10년 전 조회 528
10년 전 조회 614
10년 전 조회 559
10년 전 조회 502
10년 전 조회 476
10년 전 조회 507
10년 전 조회 485
10년 전 조회 498
10년 전 조회 529
10년 전 조회 463
10년 전 조회 511
10년 전 조회 471
10년 전 조회 575
10년 전 조회 679
10년 전 조회 627
10년 전 조회 593
10년 전 조회 509
10년 전 조회 610
10년 전 조회 522
10년 전 조회 552
10년 전 조회 504
10년 전 조회 485
10년 전 조회 475
10년 전 조회 515
10년 전 조회 584
10년 전 조회 529
10년 전 조회 616