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

· 9년 전 · 575

<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년 전 조회 557
9년 전 조회 662
9년 전 조회 573
9년 전 조회 664
9년 전 조회 748
9년 전 조회 536
9년 전 조회 598
9년 전 조회 597
9년 전 조회 729
9년 전 조회 561
9년 전 조회 680
9년 전 조회 513
9년 전 조회 570
9년 전 조회 449
9년 전 조회 653
9년 전 조회 538
9년 전 조회 549
9년 전 조회 596
9년 전 조회 550
9년 전 조회 555
9년 전 조회 514
9년 전 조회 899
9년 전 조회 936
9년 전 조회 927
9년 전 조회 849
9년 전 조회 638
9년 전 조회 821
9년 전 조회 935
9년 전 조회 626
9년 전 조회 922
9년 전 조회 878
9년 전 조회 1,277
9년 전 조회 894
9년 전 조회 1,080
9년 전 조회 740
9년 전 조회 874
9년 전 조회 629
9년 전 조회 616
9년 전 조회 740
9년 전 조회 703
9년 전 조회 878
9년 전 조회 599
9년 전 조회 680
9년 전 조회 625
9년 전 조회 564
9년 전 조회 660
9년 전 조회 511
9년 전 조회 557
9년 전 조회 506
9년 전 조회 576
9년 전 조회 560
9년 전 조회 1,005
9년 전 조회 527
9년 전 조회 456
9년 전 조회 722
9년 전 조회 537
9년 전 조회 529
9년 전 조회 503
9년 전 조회 475
9년 전 조회 430
9년 전 조회 406
9년 전 조회 478
9년 전 조회 494
9년 전 조회 436
9년 전 조회 380
9년 전 조회 481
9년 전 조회 426
9년 전 조회 451
9년 전 조회 486
9년 전 조회 518
9년 전 조회 406
9년 전 조회 455
9년 전 조회 509
9년 전 조회 438
9년 전 조회 549
9년 전 조회 489
9년 전 조회 422
9년 전 조회 383
9년 전 조회 435
9년 전 조회 377
9년 전 조회 415
9년 전 조회 445
9년 전 조회 380
10년 전 조회 428
10년 전 조회 395
10년 전 조회 497
10년 전 조회 593
10년 전 조회 549
10년 전 조회 505
10년 전 조회 431
10년 전 조회 523
10년 전 조회 444
10년 전 조회 472
10년 전 조회 426
10년 전 조회 400
10년 전 조회 406
10년 전 조회 445
10년 전 조회 502
10년 전 조회 456
10년 전 조회 518
🐛 버그신고