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

· 9년 전 · 568

<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년 전 조회 549
9년 전 조회 657
9년 전 조회 569
9년 전 조회 659
9년 전 조회 745
9년 전 조회 532
9년 전 조회 595
9년 전 조회 591
9년 전 조회 720
9년 전 조회 558
9년 전 조회 677
9년 전 조회 505
9년 전 조회 563
9년 전 조회 446
9년 전 조회 648
9년 전 조회 534
9년 전 조회 547
9년 전 조회 592
9년 전 조회 544
9년 전 조회 551
9년 전 조회 509
9년 전 조회 895
9년 전 조회 934
9년 전 조회 920
9년 전 조회 847
9년 전 조회 635
9년 전 조회 817
9년 전 조회 927
9년 전 조회 620
9년 전 조회 922
9년 전 조회 877
9년 전 조회 1,274
9년 전 조회 891
9년 전 조회 1,077
9년 전 조회 731
9년 전 조회 868
9년 전 조회 622
9년 전 조회 610
9년 전 조회 734
9년 전 조회 695
9년 전 조회 876
9년 전 조회 597
9년 전 조회 675
9년 전 조회 621
9년 전 조회 558
9년 전 조회 654
9년 전 조회 510
9년 전 조회 556
9년 전 조회 502
9년 전 조회 569
9년 전 조회 554
9년 전 조회 1,001
9년 전 조회 526
9년 전 조회 453
9년 전 조회 721
9년 전 조회 531
9년 전 조회 526
9년 전 조회 501
9년 전 조회 471
9년 전 조회 424
9년 전 조회 402
9년 전 조회 471
9년 전 조회 486
9년 전 조회 432
9년 전 조회 375
9년 전 조회 477
9년 전 조회 426
9년 전 조회 447
9년 전 조회 479
9년 전 조회 514
9년 전 조회 403
9년 전 조회 451
9년 전 조회 505
9년 전 조회 434
9년 전 조회 546
9년 전 조회 477
9년 전 조회 416
9년 전 조회 377
9년 전 조회 429
9년 전 조회 375
9년 전 조회 412
9년 전 조회 443
9년 전 조회 376
10년 전 조회 425
10년 전 조회 390
10년 전 조회 495
10년 전 조회 589
10년 전 조회 544
10년 전 조회 501
10년 전 조회 427
10년 전 조회 515
10년 전 조회 439
10년 전 조회 465
10년 전 조회 423
10년 전 조회 395
10년 전 조회 401
10년 전 조회 439
10년 전 조회 497
10년 전 조회 453
10년 전 조회 512
🐛 버그신고