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

· 9년 전 · 419

<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년 전 조회 402
9년 전 조회 508
9년 전 조회 450
9년 전 조회 520
9년 전 조회 607
9년 전 조회 392
9년 전 조회 454
9년 전 조회 453
9년 전 조회 594
9년 전 조회 405
9년 전 조회 523
9년 전 조회 380
9년 전 조회 423
9년 전 조회 333
9년 전 조회 522
9년 전 조회 405
9년 전 조회 416
9년 전 조회 454
9년 전 조회 414
9년 전 조회 410
9년 전 조회 362
9년 전 조회 755
9년 전 조회 814
9년 전 조회 778
9년 전 조회 696
9년 전 조회 480
9년 전 조회 671
9년 전 조회 780
9년 전 조회 467
9년 전 조회 765
9년 전 조회 731
9년 전 조회 1,123
9년 전 조회 735
9년 전 조회 930
9년 전 조회 609
9년 전 조회 717
9년 전 조회 502
9년 전 조회 463
9년 전 조회 586
9년 전 조회 560
9년 전 조회 735
9년 전 조회 448
9년 전 조회 536
9년 전 조회 481
9년 전 조회 431
9년 전 조회 499
9년 전 조회 387
9년 전 조회 403
9년 전 조회 368
9년 전 조회 420
9년 전 조회 402
9년 전 조회 852
9년 전 조회 369
9년 전 조회 304
9년 전 조회 565
9년 전 조회 379
9년 전 조회 404
9년 전 조회 355
9년 전 조회 331
9년 전 조회 287
9년 전 조회 274
9년 전 조회 329
9년 전 조회 349
9년 전 조회 288
9년 전 조회 233
9년 전 조회 343
9년 전 조회 285
9년 전 조회 311
9년 전 조회 328
9년 전 조회 369
9년 전 조회 262
9년 전 조회 302
9년 전 조회 368
9년 전 조회 286
9년 전 조회 405
9년 전 조회 340
9년 전 조회 272
9년 전 조회 242
9년 전 조회 291
9년 전 조회 236
9년 전 조회 276
9년 전 조회 299
9년 전 조회 240
9년 전 조회 295
9년 전 조회 253
9년 전 조회 367
9년 전 조회 454
10년 전 조회 411
10년 전 조회 363
10년 전 조회 321
10년 전 조회 368
10년 전 조회 308
10년 전 조회 338
10년 전 조회 291
10년 전 조회 260
10년 전 조회 270
10년 전 조회 303
10년 전 조회 361
10년 전 조회 329
10년 전 조회 381
🐛 버그신고