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

· 9년 전 · 576

<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년 전 조회 558
9년 전 조회 663
9년 전 조회 575
9년 전 조회 665
9년 전 조회 748
9년 전 조회 536
9년 전 조회 600
9년 전 조회 598
9년 전 조회 731
9년 전 조회 561
9년 전 조회 681
9년 전 조회 514
9년 전 조회 571
9년 전 조회 450
9년 전 조회 654
9년 전 조회 539
9년 전 조회 550
9년 전 조회 597
9년 전 조회 550
9년 전 조회 555
9년 전 조회 515
9년 전 조회 900
9년 전 조회 937
9년 전 조회 928
9년 전 조회 850
9년 전 조회 639
9년 전 조회 821
9년 전 조회 936
9년 전 조회 627
9년 전 조회 922
9년 전 조회 878
9년 전 조회 1,278
9년 전 조회 895
9년 전 조회 1,083
9년 전 조회 741
9년 전 조회 875
9년 전 조회 630
9년 전 조회 618
9년 전 조회 741
9년 전 조회 705
9년 전 조회 878
9년 전 조회 603
9년 전 조회 681
9년 전 조회 626
9년 전 조회 564
9년 전 조회 660
9년 전 조회 513
9년 전 조회 560
9년 전 조회 508
9년 전 조회 577
9년 전 조회 561
9년 전 조회 1,006
9년 전 조회 528
9년 전 조회 458
9년 전 조회 722
9년 전 조회 537
9년 전 조회 530
9년 전 조회 503
9년 전 조회 477
9년 전 조회 430
9년 전 조회 407
9년 전 조회 481
9년 전 조회 494
9년 전 조회 438
9년 전 조회 381
9년 전 조회 481
9년 전 조회 427
9년 전 조회 452
9년 전 조회 488
9년 전 조회 519
9년 전 조회 406
9년 전 조회 456
9년 전 조회 510
9년 전 조회 439
9년 전 조회 551
9년 전 조회 491
9년 전 조회 423
9년 전 조회 383
9년 전 조회 439
9년 전 조회 378
9년 전 조회 416
9년 전 조회 447
9년 전 조회 382
10년 전 조회 428
10년 전 조회 396
10년 전 조회 499
10년 전 조회 594
10년 전 조회 550
10년 전 조회 505
10년 전 조회 431
10년 전 조회 526
10년 전 조회 445
10년 전 조회 472
10년 전 조회 427
10년 전 조회 401
10년 전 조회 406
10년 전 조회 445
10년 전 조회 503
10년 전 조회 458
10년 전 조회 518
🐛 버그신고