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

· 10년 전 · 1572

<SCRIPT LANGUAGE="JavaScript">
<!--
function maskHp(obj) {
    var str = obj.value;
    if ( str ) {
        //var pattern = /[^(ㄱ-힣)]|[-/\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);'  >
 

|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
10년 전 조회 1,617
10년 전 조회 1,707
10년 전 조회 1,648
10년 전 조회 1,669
10년 전 조회 1,792
10년 전 조회 1,589
10년 전 조회 1,595
10년 전 조회 1,643
10년 전 조회 1,763
10년 전 조회 1,601
10년 전 조회 1,728
10년 전 조회 1,527
10년 전 조회 1,610
10년 전 조회 1,424
10년 전 조회 1,653
10년 전 조회 1,454
10년 전 조회 1,501
10년 전 조회 1,607
10년 전 조회 1,508
10년 전 조회 1,546
10년 전 조회 1,474
10년 전 조회 1,881
10년 전 조회 1,902
10년 전 조회 1,889
10년 전 조회 1,851
10년 전 조회 1,638
10년 전 조회 1,756
10년 전 조회 1,928
10년 전 조회 1,633
10년 전 조회 1,910
10년 전 조회 1,886
10년 전 조회 2,262
10년 전 조회 1,872
10년 전 조회 2,079
10년 전 조회 1,697
10년 전 조회 1,860
10년 전 조회 1,551
10년 전 조회 1,635
10년 전 조회 1,676
10년 전 조회 1,674
10년 전 조회 1,845
10년 전 조회 1,611
10년 전 조회 1,636
10년 전 조회 1,647
10년 전 조회 1,553
10년 전 조회 1,611
10년 전 조회 1,429
10년 전 조회 1,510
10년 전 조회 1,419
10년 전 조회 1,573
10년 전 조회 1,516
10년 전 조회 1,979
10년 전 조회 1,444
10년 전 조회 1,422
10년 전 조회 1,681
10년 전 조회 1,473
10년 전 조회 1,447
10년 전 조회 1,454
10년 전 조회 1,408
10년 전 조회 1,341
10년 전 조회 1,306
10년 전 조회 1,424
10년 전 조회 1,394
10년 전 조회 1,356
10년 전 조회 1,239
10년 전 조회 1,322
10년 전 조회 1,324
10년 전 조회 1,340
10년 전 조회 1,386
10년 전 조회 1,373
10년 전 조회 1,321
10년 전 조회 1,324
10년 전 조회 1,369
10년 전 조회 1,344
10년 전 조회 1,431
10년 전 조회 1,343
10년 전 조회 1,292
10년 전 조회 1,270
10년 전 조회 1,293
10년 전 조회 1,305
10년 전 조회 1,305
10년 전 조회 1,323
10년 전 조회 1,268
10년 전 조회 1,328
10년 전 조회 1,264
10년 전 조회 1,369
10년 전 조회 1,454
10년 전 조회 1,425
10년 전 조회 1,358
10년 전 조회 1,273
10년 전 조회 1,399
10년 전 조회 1,297
10년 전 조회 1,347
10년 전 조회 1,293
10년 전 조회 1,261
10년 전 조회 1,251
10년 전 조회 1,283
10년 전 조회 1,360
10년 전 조회 1,302
10년 전 조회 1,387