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

· 9년 전 · 526

<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년 전 조회 512
9년 전 조회 622
9년 전 조회 548
9년 전 조회 615
9년 전 조회 710
9년 전 조회 493
9년 전 조회 554
9년 전 조회 549
9년 전 조회 691
9년 전 조회 511
9년 전 조회 640
9년 전 조회 466
9년 전 조회 527
9년 전 조회 409
9년 전 조회 612
9년 전 조회 493
9년 전 조회 499
9년 전 조회 548
9년 전 조회 510
9년 전 조회 510
9년 전 조회 474
9년 전 조회 859
9년 전 조회 897
9년 전 조회 875
9년 전 조회 800
9년 전 조회 595
9년 전 조회 764
9년 전 조회 890
9년 전 조회 576
9년 전 조회 876
9년 전 조회 836
9년 전 조회 1,229
9년 전 조회 845
9년 전 조회 1,036
9년 전 조회 691
9년 전 조회 825
9년 전 조회 578
9년 전 조회 571
9년 전 조회 696
9년 전 조회 661
9년 전 조회 842
9년 전 조회 556
9년 전 조회 636
9년 전 조회 588
9년 전 조회 523
9년 전 조회 609
9년 전 조회 467
9년 전 조회 502
9년 전 조회 461
9년 전 조회 527
9년 전 조회 508
9년 전 조회 954
9년 전 조회 481
9년 전 조회 411
9년 전 조회 667
9년 전 조회 490
9년 전 조회 484
9년 전 조회 461
9년 전 조회 428
9년 전 조회 380
9년 전 조회 358
9년 전 조회 422
9년 전 조회 440
9년 전 조회 391
9년 전 조회 331
9년 전 조회 428
9년 전 조회 378
9년 전 조회 403
9년 전 조회 430
9년 전 조회 465
9년 전 조회 343
9년 전 조회 397
9년 전 조회 454
9년 전 조회 381
9년 전 조회 496
9년 전 조회 429
9년 전 조회 369
9년 전 조회 332
9년 전 조회 387
9년 전 조회 331
9년 전 조회 364
9년 전 조회 393
9년 전 조회 327
9년 전 조회 380
9년 전 조회 348
9년 전 조회 442
9년 전 조회 540
10년 전 조회 500
10년 전 조회 453
10년 전 조회 384
10년 전 조회 461
10년 전 조회 400
10년 전 조회 424
10년 전 조회 373
10년 전 조회 345
10년 전 조회 348
10년 전 조회 378
10년 전 조회 445
10년 전 조회 410
10년 전 조회 457
🐛 버그신고