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

· 9년 전 · 480

<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년 전 조회 479
9년 전 조회 585
9년 전 조회 508
9년 전 조회 574
9년 전 조회 665
9년 전 조회 443
9년 전 조회 507
9년 전 조회 505
9년 전 조회 656
9년 전 조회 471
9년 전 조회 605
9년 전 조회 434
9년 전 조회 486
9년 전 조회 373
9년 전 조회 574
9년 전 조회 466
9년 전 조회 471
9년 전 조회 514
9년 전 조회 466
9년 전 조회 470
9년 전 조회 431
9년 전 조회 815
9년 전 조회 864
9년 전 조회 836
9년 전 조회 758
9년 전 조회 546
9년 전 조회 725
9년 전 조회 845
9년 전 조회 536
9년 전 조회 822
9년 전 조회 787
9년 전 조회 1,191
9년 전 조회 792
9년 전 조회 992
9년 전 조회 657
9년 전 조회 777
9년 전 조회 550
9년 전 조회 520
9년 전 조회 646
9년 전 조회 613
9년 전 조회 798
9년 전 조회 509
9년 전 조회 587
9년 전 조회 539
9년 전 조회 484
9년 전 조회 561
9년 전 조회 430
9년 전 조회 462
9년 전 조회 419
9년 전 조회 481
9년 전 조회 463
9년 전 조회 907
9년 전 조회 431
9년 전 조회 359
9년 전 조회 628
9년 전 조회 440
9년 전 조회 449
9년 전 조회 410
9년 전 조회 384
9년 전 조회 340
9년 전 조회 320
9년 전 조회 373
9년 전 조회 394
9년 전 조회 333
9년 전 조회 276
9년 전 조회 389
9년 전 조회 334
9년 전 조회 357
9년 전 조회 380
9년 전 조회 411
9년 전 조회 297
9년 전 조회 342
9년 전 조회 402
9년 전 조회 329
9년 전 조회 446
9년 전 조회 379
9년 전 조회 310
9년 전 조회 284
9년 전 조회 333
9년 전 조회 280
9년 전 조회 317
9년 전 조회 343
9년 전 조회 275
9년 전 조회 336
9년 전 조회 294
9년 전 조회 406
9년 전 조회 490
10년 전 조회 450
10년 전 조회 398
10년 전 조회 352
10년 전 조회 406
10년 전 조회 348
10년 전 조회 371
10년 전 조회 330
10년 전 조회 294
10년 전 조회 300
10년 전 조회 332
10년 전 조회 400
10년 전 조회 366
10년 전 조회 412
🐛 버그신고