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

· 9년 전 · 554

<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년 전 조회 536
9년 전 조회 647
9년 전 조회 565
9년 전 조회 646
9년 전 조회 733
9년 전 조회 521
9년 전 조회 584
9년 전 조회 580
9년 전 조회 711
9년 전 조회 542
9년 전 조회 658
9년 전 조회 492
9년 전 조회 552
9년 전 조회 433
9년 전 조회 633
9년 전 조회 521
9년 전 조회 527
9년 전 조회 582
9년 전 조회 532
9년 전 조회 534
9년 전 조회 499
9년 전 조회 881
9년 전 조회 924
9년 전 조회 910
9년 전 조회 834
9년 전 조회 620
9년 전 조회 795
9년 전 조회 917
9년 전 조회 606
9년 전 조회 907
9년 전 조회 864
9년 전 조회 1,262
9년 전 조회 877
9년 전 조회 1,061
9년 전 조회 717
9년 전 조회 854
9년 전 조회 605
9년 전 조회 597
9년 전 조회 723
9년 전 조회 687
9년 전 조회 863
9년 전 조회 586
9년 전 조회 665
9년 전 조회 612
9년 전 조회 549
9년 전 조회 638
9년 전 조회 496
9년 전 조회 540
9년 전 조회 490
9년 전 조회 555
9년 전 조회 539
9년 전 조회 989
9년 전 조회 514
9년 전 조회 439
9년 전 조회 701
9년 전 조회 519
9년 전 조회 511
9년 전 조회 486
9년 전 조회 456
9년 전 조회 409
9년 전 조회 383
9년 전 조회 455
9년 전 조회 470
9년 전 조회 419
9년 전 조회 363
9년 전 조회 454
9년 전 조회 407
9년 전 조회 437
9년 전 조회 467
9년 전 조회 500
9년 전 조회 385
9년 전 조회 437
9년 전 조회 491
9년 전 조회 414
9년 전 조회 535
9년 전 조회 462
9년 전 조회 405
9년 전 조회 362
9년 전 조회 415
9년 전 조회 358
9년 전 조회 396
9년 전 조회 426
9년 전 조회 364
10년 전 조회 408
10년 전 조회 375
10년 전 조회 482
10년 전 조회 573
10년 전 조회 531
10년 전 조회 486
10년 전 조회 416
10년 전 조회 503
10년 전 조회 422
10년 전 조회 452
10년 전 조회 408
10년 전 조회 377
10년 전 조회 382
10년 전 조회 419
10년 전 조회 485
10년 전 조회 438
10년 전 조회 497
🐛 버그신고