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

· 9년 전 · 518

<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년 전 조회 504
9년 전 조회 613
9년 전 조회 540
9년 전 조회 603
9년 전 조회 699
9년 전 조회 476
9년 전 조회 542
9년 전 조회 541
9년 전 조회 680
9년 전 조회 498
9년 전 조회 632
9년 전 조회 459
9년 전 조회 518
9년 전 조회 401
9년 전 조회 601
9년 전 조회 486
9년 전 조회 492
9년 전 조회 538
9년 전 조회 501
9년 전 조회 501
9년 전 조회 461
9년 전 조회 850
9년 전 조회 888
9년 전 조회 864
9년 전 조회 789
9년 전 조회 582
9년 전 조회 760
9년 전 조회 877
9년 전 조회 565
9년 전 조회 861
9년 전 조회 827
9년 전 조회 1,220
9년 전 조회 835
9년 전 조회 1,028
9년 전 조회 684
9년 전 조회 818
9년 전 조회 572
9년 전 조회 562
9년 전 조회 684
9년 전 조회 651
9년 전 조회 832
9년 전 조회 547
9년 전 조회 627
9년 전 조회 578
9년 전 조회 515
9년 전 조회 594
9년 전 조회 460
9년 전 조회 496
9년 전 조회 452
9년 전 조회 519
9년 전 조회 500
9년 전 조회 940
9년 전 조회 468
9년 전 조회 397
9년 전 조회 658
9년 전 조회 484
9년 전 조회 478
9년 전 조회 450
9년 전 조회 418
9년 전 조회 369
9년 전 조회 350
9년 전 조회 409
9년 전 조회 425
9년 전 조회 375
9년 전 조회 318
9년 전 조회 421
9년 전 조회 364
9년 전 조회 392
9년 전 조회 416
9년 전 조회 451
9년 전 조회 332
9년 전 조회 380
9년 전 조회 436
9년 전 조회 369
9년 전 조회 485
9년 전 조회 417
9년 전 조회 355
9년 전 조회 320
9년 전 조회 371
9년 전 조회 323
9년 전 조회 354
9년 전 조회 381
9년 전 조회 313
9년 전 조회 368
9년 전 조회 333
9년 전 조회 434
9년 전 조회 530
10년 전 조회 488
10년 전 조회 435
10년 전 조회 379
10년 전 조회 452
10년 전 조회 386
10년 전 조회 410
10년 전 조회 361
10년 전 조회 332
10년 전 조회 334
10년 전 조회 366
10년 전 조회 431
10년 전 조회 398
10년 전 조회 447
🐛 버그신고