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

· 9년 전 · 574

<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년 전 조회 572
9년 전 조회 663
9년 전 조회 748
9년 전 조회 536
9년 전 조회 597
9년 전 조회 595
9년 전 조회 726
9년 전 조회 561
9년 전 조회 680
9년 전 조회 511
9년 전 조회 569
9년 전 조회 448
9년 전 조회 652
9년 전 조회 537
9년 전 조회 549
9년 전 조회 595
9년 전 조회 550
9년 전 조회 554
9년 전 조회 513
9년 전 조회 896
9년 전 조회 936
9년 전 조회 926
9년 전 조회 849
9년 전 조회 638
9년 전 조회 821
9년 전 조회 934
9년 전 조회 626
9년 전 조회 922
9년 전 조회 877
9년 전 조회 1,277
9년 전 조회 893
9년 전 조회 1,080
9년 전 조회 738
9년 전 조회 874
9년 전 조회 628
9년 전 조회 614
9년 전 조회 738
9년 전 조회 703
9년 전 조회 876
9년 전 조회 599
9년 전 조회 679
9년 전 조회 623
9년 전 조회 563
9년 전 조회 659
9년 전 조회 511
9년 전 조회 557
9년 전 조회 505
9년 전 조회 575
9년 전 조회 559
9년 전 조회 1,004
9년 전 조회 527
9년 전 조회 454
9년 전 조회 722
9년 전 조회 537
9년 전 조회 529
9년 전 조회 503
9년 전 조회 473
9년 전 조회 428
9년 전 조회 404
9년 전 조회 477
9년 전 조회 490
9년 전 조회 434
9년 전 조회 379
9년 전 조회 480
9년 전 조회 426
9년 전 조회 449
9년 전 조회 484
9년 전 조회 515
9년 전 조회 405
9년 전 조회 453
9년 전 조회 508
9년 전 조회 438
9년 전 조회 548
9년 전 조회 487
9년 전 조회 421
9년 전 조회 382
9년 전 조회 435
9년 전 조회 376
9년 전 조회 415
9년 전 조회 445
9년 전 조회 379
10년 전 조회 426
10년 전 조회 395
10년 전 조회 496
10년 전 조회 593
10년 전 조회 549
10년 전 조회 504
10년 전 조회 430
10년 전 조회 522
10년 전 조회 443
10년 전 조회 472
10년 전 조회 423
10년 전 조회 399
10년 전 조회 403
10년 전 조회 442
10년 전 조회 500
10년 전 조회 455
10년 전 조회 515
🐛 버그신고