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

· 10년 전 · 1173

<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);'  >
 

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

프로그램

+
제목 글쓴이 날짜 조회
9년 전 조회 1,218
9년 전 조회 1,324
9년 전 조회 1,208
9년 전 조회 1,289
9년 전 조회 1,414
9년 전 조회 1,201
9년 전 조회 1,254
9년 전 조회 1,229
9년 전 조회 1,367
9년 전 조회 1,204
9년 전 조회 1,331
9년 전 조회 1,165
9년 전 조회 1,232
9년 전 조회 1,074
9년 전 조회 1,295
9년 전 조회 1,155
9년 전 조회 1,162
9년 전 조회 1,207
9년 전 조회 1,165
9년 전 조회 1,185
9년 전 조회 1,120
10년 전 조회 1,499
10년 전 조회 1,571
10년 전 조회 1,523
10년 전 조회 1,461
10년 전 조회 1,256
10년 전 조회 1,396
10년 전 조회 1,555
10년 전 조회 1,234
10년 전 조회 1,581
10년 전 조회 1,533
10년 전 조회 1,893
10년 전 조회 1,496
10년 전 조회 1,710
10년 전 조회 1,334
10년 전 조회 1,479
10년 전 조회 1,199
10년 전 조회 1,248
10년 전 조회 1,328
10년 전 조회 1,321
10년 전 조회 1,429
10년 전 조회 1,252
10년 전 조회 1,273
10년 전 조회 1,223
10년 전 조회 1,190
10년 전 조회 1,253
10년 전 조회 1,102
10년 전 조회 1,139
10년 전 조회 1,048
10년 전 조회 1,174
10년 전 조회 1,145
10년 전 조회 1,613
10년 전 조회 1,094
10년 전 조회 1,049
10년 전 조회 1,309
10년 전 조회 1,111
10년 전 조회 1,080
10년 전 조회 1,092
10년 전 조회 1,066
10년 전 조회 998
10년 전 조회 976
10년 전 조회 1,040
10년 전 조회 1,056
10년 전 조회 996
10년 전 조회 914
10년 전 조회 985
10년 전 조회 944
10년 전 조회 987
10년 전 조회 1,023
10년 전 조회 1,020
10년 전 조회 970
10년 전 조회 975
10년 전 조회 1,038
10년 전 조회 1,014
10년 전 조회 1,068
10년 전 조회 1,020
10년 전 조회 951
10년 전 조회 924
10년 전 조회 944
10년 전 조회 916
10년 전 조회 950
10년 전 조회 980
10년 전 조회 936
10년 전 조회 985
10년 전 조회 946
10년 전 조회 1,032
10년 전 조회 1,147
10년 전 조회 1,095
10년 전 조회 1,039
10년 전 조회 970
10년 전 조회 1,055
10년 전 조회 979
10년 전 조회 1,013
10년 전 조회 960
10년 전 조회 963
10년 전 조회 947
10년 전 조회 976
10년 전 조회 1,059
10년 전 조회 1,003
10년 전 조회 1,089