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

· 9년 전 · 452

<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년 전 조회 454
9년 전 조회 563
9년 전 조회 486
9년 전 조회 550
9년 전 조회 644
9년 전 조회 424
9년 전 조회 489
9년 전 조회 484
9년 전 조회 640
9년 전 조회 452
9년 전 조회 582
9년 전 조회 416
9년 전 조회 459
9년 전 조회 360
9년 전 조회 557
9년 전 조회 439
9년 전 조회 454
9년 전 조회 491
9년 전 조회 449
9년 전 조회 444
9년 전 조회 404
9년 전 조회 795
9년 전 조회 841
9년 전 조회 808
9년 전 조회 739
9년 전 조회 525
9년 전 조회 704
9년 전 조회 820
9년 전 조회 515
9년 전 조회 799
9년 전 조회 766
9년 전 조회 1,167
9년 전 조회 773
9년 전 조회 973
9년 전 조회 642
9년 전 조회 755
9년 전 조회 530
9년 전 조회 494
9년 전 조회 624
9년 전 조회 589
9년 전 조회 776
9년 전 조회 488
9년 전 조회 567
9년 전 조회 524
9년 전 조회 463
9년 전 조회 534
9년 전 조회 412
9년 전 조회 447
9년 전 조회 404
9년 전 조회 453
9년 전 조회 443
9년 전 조회 888
9년 전 조회 408
9년 전 조회 342
9년 전 조회 608
9년 전 조회 416
9년 전 조회 433
9년 전 조회 384
9년 전 조회 359
9년 전 조회 318
9년 전 조회 304
9년 전 조회 355
9년 전 조회 379
9년 전 조회 316
9년 전 조회 259
9년 전 조회 370
9년 전 조회 309
9년 전 조회 337
9년 전 조회 353
9년 전 조회 393
9년 전 조회 282
9년 전 조회 326
9년 전 조회 382
9년 전 조회 306
9년 전 조회 424
9년 전 조회 353
9년 전 조회 291
9년 전 조회 261
9년 전 조회 306
9년 전 조회 256
9년 전 조회 294
9년 전 조회 319
9년 전 조회 255
9년 전 조회 316
9년 전 조회 269
9년 전 조회 387
9년 전 조회 468
10년 전 조회 427
10년 전 조회 376
10년 전 조회 336
10년 전 조회 384
10년 전 조회 325
10년 전 조회 351
10년 전 조회 314
10년 전 조회 273
10년 전 조회 287
10년 전 조회 314
10년 전 조회 375
10년 전 조회 347
10년 전 조회 397
🐛 버그신고