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

· 9년 전 · 524

<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년 전 조회 511
9년 전 조회 621
9년 전 조회 547
9년 전 조회 614
9년 전 조회 708
9년 전 조회 493
9년 전 조회 552
9년 전 조회 548
9년 전 조회 691
9년 전 조회 509
9년 전 조회 640
9년 전 조회 464
9년 전 조회 525
9년 전 조회 409
9년 전 조회 610
9년 전 조회 493
9년 전 조회 498
9년 전 조회 546
9년 전 조회 508
9년 전 조회 509
9년 전 조회 471
9년 전 조회 857
9년 전 조회 897
9년 전 조회 873
9년 전 조회 799
9년 전 조회 592
9년 전 조회 763
9년 전 조회 890
9년 전 조회 575
9년 전 조회 875
9년 전 조회 835
9년 전 조회 1,226
9년 전 조회 843
9년 전 조회 1,034
9년 전 조회 689
9년 전 조회 824
9년 전 조회 577
9년 전 조회 570
9년 전 조회 694
9년 전 조회 661
9년 전 조회 840
9년 전 조회 555
9년 전 조회 635
9년 전 조회 585
9년 전 조회 523
9년 전 조회 607
9년 전 조회 466
9년 전 조회 502
9년 전 조회 460
9년 전 조회 525
9년 전 조회 506
9년 전 조회 951
9년 전 조회 478
9년 전 조회 411
9년 전 조회 666
9년 전 조회 489
9년 전 조회 484
9년 전 조회 459
9년 전 조회 425
9년 전 조회 379
9년 전 조회 357
9년 전 조회 419
9년 전 조회 436
9년 전 조회 389
9년 전 조회 329
9년 전 조회 428
9년 전 조회 373
9년 전 조회 401
9년 전 조회 428
9년 전 조회 462
9년 전 조회 341
9년 전 조회 395
9년 전 조회 453
9년 전 조회 380
9년 전 조회 495
9년 전 조회 427
9년 전 조회 366
9년 전 조회 331
9년 전 조회 384
9년 전 조회 328
9년 전 조회 363
9년 전 조회 391
9년 전 조회 326
9년 전 조회 379
9년 전 조회 347
9년 전 조회 442
9년 전 조회 539
10년 전 조회 498
10년 전 조회 451
10년 전 조회 383
10년 전 조회 460
10년 전 조회 399
10년 전 조회 423
10년 전 조회 372
10년 전 조회 344
10년 전 조회 346
10년 전 조회 377
10년 전 조회 443
10년 전 조회 410
10년 전 조회 454
🐛 버그신고