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

· 9년 전 · 549

<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년 전 조회 533
9년 전 조회 639
9년 전 조회 564
9년 전 조회 640
9년 전 조회 731
9년 전 조회 515
9년 전 조회 577
9년 전 조회 572
9년 전 조회 708
9년 전 조회 535
9년 전 조회 656
9년 전 조회 485
9년 전 조회 549
9년 전 조회 427
9년 전 조회 628
9년 전 조회 516
9년 전 조회 522
9년 전 조회 572
9년 전 조회 528
9년 전 조회 530
9년 전 조회 492
9년 전 조회 874
9년 전 조회 919
9년 전 조회 903
9년 전 조회 828
9년 전 조회 615
9년 전 조회 790
9년 전 조회 912
9년 전 조회 603
9년 전 조회 901
9년 전 조회 859
9년 전 조회 1,259
9년 전 조회 872
9년 전 조회 1,054
9년 전 조회 709
9년 전 조회 849
9년 전 조회 599
9년 전 조회 591
9년 전 조회 717
9년 전 조회 681
9년 전 조회 861
9년 전 조회 577
9년 전 조회 661
9년 전 조회 609
9년 전 조회 543
9년 전 조회 632
9년 전 조회 490
9년 전 조회 530
9년 전 조회 484
9년 전 조회 550
9년 전 조회 536
9년 전 조회 981
9년 전 조회 507
9년 전 조회 434
9년 전 조회 692
9년 전 조회 515
9년 전 조회 507
9년 전 조회 485
9년 전 조회 450
9년 전 조회 403
9년 전 조회 375
9년 전 조회 450
9년 전 조회 467
9년 전 조회 415
9년 전 조회 359
9년 전 조회 449
9년 전 조회 403
9년 전 조회 432
9년 전 조회 465
9년 전 조회 491
9년 전 조회 376
9년 전 조회 429
9년 전 조회 489
9년 전 조회 408
9년 전 조회 527
9년 전 조회 459
9년 전 조회 394
9년 전 조회 357
9년 전 조회 410
9년 전 조회 354
9년 전 조회 391
9년 전 조회 416
9년 전 조회 358
10년 전 조회 403
10년 전 조회 370
10년 전 조회 475
10년 전 조회 571
10년 전 조회 522
10년 전 조회 482
10년 전 조회 410
10년 전 조회 495
10년 전 조회 417
10년 전 조회 447
10년 전 조회 402
10년 전 조회 373
10년 전 조회 373
10년 전 조회 409
10년 전 조회 479
10년 전 조회 429
10년 전 조회 489
🐛 버그신고