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

· 9년 전 · 567

<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년 전 조회 546
9년 전 조회 657
9년 전 조회 568
9년 전 조회 656
9년 전 조회 744
9년 전 조회 530
9년 전 조회 592
9년 전 조회 585
9년 전 조회 720
9년 전 조회 556
9년 전 조회 676
9년 전 조회 500
9년 전 조회 561
9년 전 조회 445
9년 전 조회 644
9년 전 조회 534
9년 전 조회 545
9년 전 조회 590
9년 전 조회 542
9년 전 조회 547
9년 전 조회 507
9년 전 조회 889
9년 전 조회 933
9년 전 조회 918
9년 전 조회 846
9년 전 조회 633
9년 전 조회 814
9년 전 조회 923
9년 전 조회 619
9년 전 조회 919
9년 전 조회 873
9년 전 조회 1,274
9년 전 조회 890
9년 전 조회 1,072
9년 전 조회 730
9년 전 조회 867
9년 전 조회 620
9년 전 조회 606
9년 전 조회 731
9년 전 조회 694
9년 전 조회 873
9년 전 조회 594
9년 전 조회 672
9년 전 조회 619
9년 전 조회 555
9년 전 조회 651
9년 전 조회 509
9년 전 조회 552
9년 전 조회 499
9년 전 조회 568
9년 전 조회 551
9년 전 조회 998
9년 전 조회 524
9년 전 조회 448
9년 전 조회 716
9년 전 조회 530
9년 전 조회 523
9년 전 조회 499
9년 전 조회 468
9년 전 조회 420
9년 전 조회 398
9년 전 조회 466
9년 전 조회 483
9년 전 조회 429
9년 전 조회 373
9년 전 조회 472
9년 전 조회 421
9년 전 조회 446
9년 전 조회 476
9년 전 조회 512
9년 전 조회 398
9년 전 조회 446
9년 전 조회 504
9년 전 조회 432
9년 전 조회 544
9년 전 조회 475
9년 전 조회 414
9년 전 조회 376
9년 전 조회 425
9년 전 조회 374
9년 전 조회 410
9년 전 조회 440
9년 전 조회 375
10년 전 조회 421
10년 전 조회 386
10년 전 조회 494
10년 전 조회 586
10년 전 조회 542
10년 전 조회 500
10년 전 조회 427
10년 전 조회 512
10년 전 조회 434
10년 전 조회 461
10년 전 조회 418
10년 전 조회 393
10년 전 조회 398
10년 전 조회 436
10년 전 조회 493
10년 전 조회 450
10년 전 조회 510
🐛 버그신고