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

· 9년 전 · 598

<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년 전 조회 585
9년 전 조회 691
9년 전 조회 603
9년 전 조회 690
9년 전 조회 780
9년 전 조회 566
9년 전 조회 626
9년 전 조회 625
9년 전 조회 760
9년 전 조회 583
9년 전 조회 705
9년 전 조회 542
9년 전 조회 604
9년 전 조회 485
9년 전 조회 674
9년 전 조회 563
9년 전 조회 575
9년 전 조회 621
9년 전 조회 577
9년 전 조회 585
9년 전 조회 541
9년 전 조회 921
9년 전 조회 972
9년 전 조회 949
9년 전 조회 879
9년 전 조회 669
9년 전 조회 846
9년 전 조회 959
9년 전 조회 646
9년 전 조회 947
9년 전 조회 907
9년 전 조회 1,307
9년 전 조회 921
9년 전 조회 1,109
9년 전 조회 771
9년 전 조회 896
9년 전 조회 658
9년 전 조회 641
9년 전 조회 763
9년 전 조회 731
9년 전 조회 900
9년 전 조회 632
9년 전 조회 706
9년 전 조회 656
9년 전 조회 593
9년 전 조회 682
9년 전 조회 546
9년 전 조회 583
9년 전 조회 532
9년 전 조회 599
9년 전 조회 585
9년 전 조회 1,033
9년 전 조회 555
9년 전 조회 484
9년 전 조회 746
9년 전 조회 568
9년 전 조회 560
9년 전 조회 526
9년 전 조회 505
9년 전 조회 451
9년 전 조회 426
9년 전 조회 507
9년 전 조회 521
9년 전 조회 460
9년 전 조회 406
9년 전 조회 512
9년 전 조회 454
9년 전 조회 480
9년 전 조회 520
9년 전 조회 540
9년 전 조회 434
9년 전 조회 476
9년 전 조회 538
9년 전 조회 471
9년 전 조회 574
9년 전 조회 512
9년 전 조회 450
10년 전 조회 410
10년 전 조회 459
10년 전 조회 400
10년 전 조회 444
10년 전 조회 474
10년 전 조회 408
10년 전 조회 461
10년 전 조회 420
10년 전 조회 523
10년 전 조회 624
10년 전 조회 580
10년 전 조회 534
10년 전 조회 466
10년 전 조회 550
10년 전 조회 471
10년 전 조회 506
10년 전 조회 460
10년 전 조회 433
10년 전 조회 438
10년 전 조회 463
10년 전 조회 535
10년 전 조회 487
10년 전 조회 548
🐛 버그신고