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

· 9년 전 · 513

<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년 전 조회 501
9년 전 조회 608
9년 전 조회 537
9년 전 조회 595
9년 전 조회 696
9년 전 조회 471
9년 전 조회 537
9년 전 조회 536
9년 전 조회 675
9년 전 조회 492
9년 전 조회 629
9년 전 조회 455
9년 전 조회 511
9년 전 조회 396
9년 전 조회 593
9년 전 조회 481
9년 전 조회 489
9년 전 조회 533
9년 전 조회 493
9년 전 조회 494
9년 전 조회 457
9년 전 조회 843
9년 전 조회 882
9년 전 조회 860
9년 전 조회 782
9년 전 조회 578
9년 전 조회 753
9년 전 조회 873
9년 전 조회 558
9년 전 조회 856
9년 전 조회 818
9년 전 조회 1,211
9년 전 조회 828
9년 전 조회 1,021
9년 전 조회 679
9년 전 조회 811
9년 전 조회 570
9년 전 조회 554
9년 전 조회 678
9년 전 조회 646
9년 전 조회 827
9년 전 조회 540
9년 전 조회 620
9년 전 조회 571
9년 전 조회 511
9년 전 조회 588
9년 전 조회 456
9년 전 조회 489
9년 전 조회 445
9년 전 조회 514
9년 전 조회 493
9년 전 조회 934
9년 전 조회 463
9년 전 조회 392
9년 전 조회 653
9년 전 조회 478
9년 전 조회 477
9년 전 조회 441
9년 전 조회 411
9년 전 조회 364
9년 전 조회 345
9년 전 조회 401
9년 전 조회 420
9년 전 조회 369
9년 전 조회 312
9년 전 조회 419
9년 전 조회 359
9년 전 조회 385
9년 전 조회 410
9년 전 조회 445
9년 전 조회 328
9년 전 조회 377
9년 전 조회 431
9년 전 조회 365
9년 전 조회 481
9년 전 조회 411
9년 전 조회 347
9년 전 조회 313
9년 전 조회 365
9년 전 조회 316
9년 전 조회 349
9년 전 조회 377
9년 전 조회 310
9년 전 조회 363
9년 전 조회 327
9년 전 조회 430
9년 전 조회 524
10년 전 조회 482
10년 전 조회 430
10년 전 조회 375
10년 전 조회 448
10년 전 조회 382
10년 전 조회 405
10년 전 조회 356
10년 전 조회 328
10년 전 조회 329
10년 전 조회 361
10년 전 조회 428
10년 전 조회 393
10년 전 조회 443
🐛 버그신고