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

· 9년 전 · 504

<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년 전 조회 493
9년 전 조회 601
9년 전 조회 530
9년 전 조회 587
9년 전 조회 688
9년 전 조회 461
9년 전 조회 524
9년 전 조회 525
9년 전 조회 669
9년 전 조회 485
9년 전 조회 622
9년 전 조회 450
9년 전 조회 502
9년 전 조회 388
9년 전 조회 590
9년 전 조회 477
9년 전 조회 486
9년 전 조회 528
9년 전 조회 486
9년 전 조회 487
9년 전 조회 451
9년 전 조회 835
9년 전 조회 874
9년 전 조회 853
9년 전 조회 777
9년 전 조회 568
9년 전 조회 746
9년 전 조회 866
9년 전 조회 549
9년 전 조회 843
9년 전 조회 809
9년 전 조회 1,202
9년 전 조회 817
9년 전 조회 1,015
9년 전 조회 671
9년 전 조회 801
9년 전 조회 564
9년 전 조회 540
9년 전 조회 672
9년 전 조회 634
9년 전 조회 822
9년 전 조회 532
9년 전 조회 613
9년 전 조회 565
9년 전 조회 506
9년 전 조회 580
9년 전 조회 447
9년 전 조회 484
9년 전 조회 440
9년 전 조회 505
9년 전 조회 485
9년 전 조회 922
9년 전 조회 452
9년 전 조회 381
9년 전 조회 644
9년 전 조회 467
9년 전 조회 469
9년 전 조회 432
9년 전 조회 396
9년 전 조회 360
9년 전 조회 337
9년 전 조회 390
9년 전 조회 411
9년 전 조회 356
9년 전 조회 300
9년 전 조회 406
9년 전 조회 353
9년 전 조회 374
9년 전 조회 399
9년 전 조회 435
9년 전 조회 319
9년 전 조회 366
9년 전 조회 423
9년 전 조회 349
9년 전 조회 468
9년 전 조회 393
9년 전 조회 335
9년 전 조회 302
9년 전 조회 351
9년 전 조회 304
9년 전 조회 338
9년 전 조회 365
9년 전 조회 297
9년 전 조회 352
9년 전 조회 313
9년 전 조회 422
9년 전 조회 511
10년 전 조회 466
10년 전 조회 416
10년 전 조회 367
10년 전 조회 434
10년 전 조회 369
10년 전 조회 396
10년 전 조회 346
10년 전 조회 314
10년 전 조회 317
10년 전 조회 350
10년 전 조회 419
10년 전 조회 382
10년 전 조회 435
🐛 버그신고