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

· 9년 전 · 490

<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년 전 조회 484
9년 전 조회 593
9년 전 조회 517
9년 전 조회 582
9년 전 조회 674
9년 전 조회 450
9년 전 조회 514
9년 전 조회 511
9년 전 조회 662
9년 전 조회 477
9년 전 조회 614
9년 전 조회 440
9년 전 조회 492
9년 전 조회 379
9년 전 조회 578
9년 전 조회 470
9년 전 조회 476
9년 전 조회 518
9년 전 조회 470
9년 전 조회 472
9년 전 조회 438
9년 전 조회 824
9년 전 조회 868
9년 전 조회 840
9년 전 조회 765
9년 전 조회 555
9년 전 조회 730
9년 전 조회 856
9년 전 조회 540
9년 전 조회 828
9년 전 조회 792
9년 전 조회 1,196
9년 전 조회 802
9년 전 조회 1,000
9년 전 조회 666
9년 전 조회 784
9년 전 조회 557
9년 전 조회 527
9년 전 조회 653
9년 전 조회 620
9년 전 조회 809
9년 전 조회 516
9년 전 조회 595
9년 전 조회 553
9년 전 조회 490
9년 전 조회 568
9년 전 조회 439
9년 전 조회 473
9년 전 조회 428
9년 전 조회 491
9년 전 조회 476
9년 전 조회 912
9년 전 조회 440
9년 전 조회 364
9년 전 조회 632
9년 전 조회 451
9년 전 조회 459
9년 전 조회 416
9년 전 조회 387
9년 전 조회 346
9년 전 조회 327
9년 전 조회 377
9년 전 조회 400
9년 전 조회 342
9년 전 조회 285
9년 전 조회 395
9년 전 조회 340
9년 전 조회 360
9년 전 조회 387
9년 전 조회 421
9년 전 조회 302
9년 전 조회 349
9년 전 조회 407
9년 전 조회 336
9년 전 조회 451
9년 전 조회 383
9년 전 조회 316
9년 전 조회 287
9년 전 조회 341
9년 전 조회 289
9년 전 조회 323
9년 전 조회 348
9년 전 조회 280
9년 전 조회 340
9년 전 조회 301
9년 전 조회 408
9년 전 조회 497
10년 전 조회 455
10년 전 조회 403
10년 전 조회 358
10년 전 조회 415
10년 전 조회 354
10년 전 조회 379
10년 전 조회 333
10년 전 조회 300
10년 전 조회 302
10년 전 조회 334
10년 전 조회 409
10년 전 조회 368
10년 전 조회 421
🐛 버그신고