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

· 9년 전 · 561

<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년 전 조회 540
9년 전 조회 649
9년 전 조회 567
9년 전 조회 649
9년 전 조회 736
9년 전 조회 523
9년 전 조회 586
9년 전 조회 581
9년 전 조회 714
9년 전 조회 547
9년 전 조회 662
9년 전 조회 494
9년 전 조회 554
9년 전 조회 435
9년 전 조회 636
9년 전 조회 524
9년 전 조회 531
9년 전 조회 585
9년 전 조회 536
9년 전 조회 538
9년 전 조회 501
9년 전 조회 884
9년 전 조회 925
9년 전 조회 912
9년 전 조회 835
9년 전 조회 624
9년 전 조회 799
9년 전 조회 919
9년 전 조회 612
9년 전 조회 909
9년 전 조회 868
9년 전 조회 1,267
9년 전 조회 881
9년 전 조회 1,062
9년 전 조회 723
9년 전 조회 860
9년 전 조회 608
9년 전 조회 598
9년 전 조회 725
9년 전 조회 688
9년 전 조회 865
9년 전 조회 586
9년 전 조회 668
9년 전 조회 614
9년 전 조회 550
9년 전 조회 642
9년 전 조회 500
9년 전 조회 543
9년 전 조회 493
9년 전 조회 562
9년 전 조회 541
9년 전 조회 992
9년 전 조회 518
9년 전 조회 439
9년 전 조회 705
9년 전 조회 522
9년 전 조회 514
9년 전 조회 488
9년 전 조회 460
9년 전 조회 414
9년 전 조회 387
9년 전 조회 459
9년 전 조회 472
9년 전 조회 422
9년 전 조회 365
9년 전 조회 457
9년 전 조회 413
9년 전 조회 440
9년 전 조회 469
9년 전 조회 502
9년 전 조회 388
9년 전 조회 440
9년 전 조회 495
9년 전 조회 417
9년 전 조회 535
9년 전 조회 464
9년 전 조회 409
9년 전 조회 369
9년 전 조회 416
9년 전 조회 363
9년 전 조회 399
9년 전 조회 427
9년 전 조회 367
10년 전 조회 411
10년 전 조회 380
10년 전 조회 485
10년 전 조회 578
10년 전 조회 536
10년 전 조회 490
10년 전 조회 421
10년 전 조회 508
10년 전 조회 426
10년 전 조회 456
10년 전 조회 412
10년 전 조회 383
10년 전 조회 385
10년 전 조회 422
10년 전 조회 485
10년 전 조회 442
10년 전 조회 498
🐛 버그신고