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

· 9년 전 · 543

<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년 전 조회 529
9년 전 조회 635
9년 전 조회 560
9년 전 조회 635
9년 전 조회 726
9년 전 조회 510
9년 전 조회 571
9년 전 조회 564
9년 전 조회 705
9년 전 조회 530
9년 전 조회 652
9년 전 조회 479
9년 전 조회 545
9년 전 조회 427
9년 전 조회 626
9년 전 조회 509
9년 전 조회 515
9년 전 조회 564
9년 전 조회 521
9년 전 조회 524
9년 전 조회 485
9년 전 조회 873
9년 전 조회 913
9년 전 조회 895
9년 전 조회 818
9년 전 조회 612
9년 전 조회 785
9년 전 조회 905
9년 전 조회 597
9년 전 조회 895
9년 전 조회 851
9년 전 조회 1,254
9년 전 조회 866
9년 전 조회 1,051
9년 전 조회 706
9년 전 조회 845
9년 전 조회 594
9년 전 조회 585
9년 전 조회 711
9년 전 조회 674
9년 전 조회 857
9년 전 조회 571
9년 전 조회 658
9년 전 조회 603
9년 전 조회 537
9년 전 조회 626
9년 전 조회 484
9년 전 조회 525
9년 전 조회 476
9년 전 조회 544
9년 전 조회 530
9년 전 조회 975
9년 전 조회 500
9년 전 조회 430
9년 전 조회 690
9년 전 조회 510
9년 전 조회 501
9년 전 조회 478
9년 전 조회 443
9년 전 조회 397
9년 전 조회 370
9년 전 조회 444
9년 전 조회 457
9년 전 조회 411
9년 전 조회 350
9년 전 조회 443
9년 전 조회 400
9년 전 조회 423
9년 전 조회 463
9년 전 조회 485
9년 전 조회 371
9년 전 조회 424
9년 전 조회 484
9년 전 조회 404
9년 전 조회 520
9년 전 조회 452
9년 전 조회 388
9년 전 조회 348
9년 전 조회 405
9년 전 조회 353
9년 전 조회 387
9년 전 조회 409
9년 전 조회 351
10년 전 조회 395
10년 전 조회 365
10년 전 조회 468
10년 전 조회 565
10년 전 조회 516
10년 전 조회 476
10년 전 조회 404
10년 전 조회 490
10년 전 조회 412
10년 전 조회 444
10년 전 조회 395
10년 전 조회 371
10년 전 조회 365
10년 전 조회 403
10년 전 조회 472
10년 전 조회 427
10년 전 조회 484
🐛 버그신고