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

· 9년 전 · 461

<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년 전 조회 464
9년 전 조회 571
9년 전 조회 499
9년 전 조회 561
9년 전 조회 650
9년 전 조회 433
9년 전 조회 499
9년 전 조회 494
9년 전 조회 646
9년 전 조회 458
9년 전 조회 589
9년 전 조회 419
9년 전 조회 469
9년 전 조회 364
9년 전 조회 560
9년 전 조회 446
9년 전 조회 460
9년 전 조회 499
9년 전 조회 455
9년 전 조회 454
9년 전 조회 413
9년 전 조회 803
9년 전 조회 850
9년 전 조회 821
9년 전 조회 746
9년 전 조회 536
9년 전 조회 708
9년 전 조회 830
9년 전 조회 519
9년 전 조회 812
9년 전 조회 773
9년 전 조회 1,173
9년 전 조회 780
9년 전 조회 982
9년 전 조회 646
9년 전 조회 762
9년 전 조회 536
9년 전 조회 503
9년 전 조회 635
9년 전 조회 600
9년 전 조회 781
9년 전 조회 500
9년 전 조회 572
9년 전 조회 531
9년 전 조회 468
9년 전 조회 542
9년 전 조회 420
9년 전 조회 453
9년 전 조회 410
9년 전 조회 462
9년 전 조회 452
9년 전 조회 892
9년 전 조회 416
9년 전 조회 350
9년 전 조회 616
9년 전 조회 425
9년 전 조회 442
9년 전 조회 394
9년 전 조회 371
9년 전 조회 329
9년 전 조회 308
9년 전 조회 364
9년 전 조회 386
9년 전 조회 321
9년 전 조회 268
9년 전 조회 377
9년 전 조회 318
9년 전 조회 346
9년 전 조회 361
9년 전 조회 398
9년 전 조회 292
9년 전 조회 334
9년 전 조회 391
9년 전 조회 311
9년 전 조회 433
9년 전 조회 361
9년 전 조회 297
9년 전 조회 269
9년 전 조회 314
9년 전 조회 268
9년 전 조회 302
9년 전 조회 330
9년 전 조회 262
9년 전 조회 320
9년 전 조회 278
9년 전 조회 393
9년 전 조회 474
10년 전 조회 435
10년 전 조회 383
10년 전 조회 341
10년 전 조회 392
10년 전 조회 333
10년 전 조회 355
10년 전 조회 318
10년 전 조회 278
10년 전 조회 292
10년 전 조회 320
10년 전 조회 384
10년 전 조회 352
10년 전 조회 403
🐛 버그신고