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

· 9년 전 · 463

<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년 전 조회 469
9년 전 조회 575
9년 전 조회 504
9년 전 조회 565
9년 전 조회 653
9년 전 조회 437
9년 전 조회 500
9년 전 조회 500
9년 전 조회 649
9년 전 조회 461
9년 전 조회 593
9년 전 조회 426
9년 전 조회 475
9년 전 조회 366
9년 전 조회 565
9년 전 조회 452
9년 전 조회 461
9년 전 조회 503
9년 전 조회 458
9년 전 조회 458
9년 전 조회 417
9년 전 조회 809
9년 전 조회 854
9년 전 조회 825
9년 전 조회 749
9년 전 조회 537
9년 전 조회 712
9년 전 조회 835
9년 전 조회 524
9년 전 조회 813
9년 전 조회 776
9년 전 조회 1,176
9년 전 조회 782
9년 전 조회 984
9년 전 조회 650
9년 전 조회 764
9년 전 조회 539
9년 전 조회 506
9년 전 조회 637
9년 전 조회 602
9년 전 조회 786
9년 전 조회 501
9년 전 조회 573
9년 전 조회 534
9년 전 조회 471
9년 전 조회 544
9년 전 조회 422
9년 전 조회 454
9년 전 조회 412
9년 전 조회 464
9년 전 조회 453
9년 전 조회 896
9년 전 조회 416
9년 전 조회 351
9년 전 조회 620
9년 전 조회 427
9년 전 조회 443
9년 전 조회 396
9년 전 조회 374
9년 전 조회 332
9년 전 조회 309
9년 전 조회 367
9년 전 조회 389
9년 전 조회 326
9년 전 조회 269
9년 전 조회 381
9년 전 조회 326
9년 전 조회 350
9년 전 조회 366
9년 전 조회 401
9년 전 조회 292
9년 전 조회 334
9년 전 조회 393
9년 전 조회 314
9년 전 조회 435
9년 전 조회 365
9년 전 조회 299
9년 전 조회 274
9년 전 조회 318
9년 전 조회 274
9년 전 조회 305
9년 전 조회 333
9년 전 조회 265
9년 전 조회 326
9년 전 조회 284
9년 전 조회 398
9년 전 조회 479
10년 전 조회 440
10년 전 조회 387
10년 전 조회 344
10년 전 조회 394
10년 전 조회 337
10년 전 조회 358
10년 전 조회 323
10년 전 조회 283
10년 전 조회 295
10년 전 조회 324
10년 전 조회 388
10년 전 조회 356
10년 전 조회 404
🐛 버그신고