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

· 10년 전 · 947

<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년 전 조회 892
9년 전 조회 1,004
9년 전 조회 907
9년 전 조회 983
9년 전 조회 1,101
9년 전 조회 880
9년 전 조회 938
9년 전 조회 943
9년 전 조회 1,075
9년 전 조회 908
9년 전 조회 1,042
9년 전 조회 841
9년 전 조회 928
9년 전 조회 769
9년 전 조회 965
9년 전 조회 851
9년 전 조회 856
9년 전 조회 926
9년 전 조회 901
9년 전 조회 891
9년 전 조회 867
9년 전 조회 1,230
9년 전 조회 1,287
9년 전 조회 1,270
9년 전 조회 1,192
10년 전 조회 1,004
10년 전 조회 1,139
10년 전 조회 1,279
10년 전 조회 951
10년 전 조회 1,362
10년 전 조회 1,235
10년 전 조회 1,633
10년 전 조회 1,241
10년 전 조회 1,432
10년 전 조회 1,060
10년 전 조회 1,230
10년 전 조회 931
10년 전 조회 967
10년 전 조회 1,070
10년 전 조회 1,049
10년 전 조회 1,196
10년 전 조회 1,026
10년 전 조회 1,027
10년 전 조회 992
10년 전 조회 914
10년 전 조회 1,020
10년 전 조회 858
10년 전 조회 904
10년 전 조회 821
10년 전 조회 948
10년 전 조회 915
10년 전 조회 1,387
10년 전 조회 894
10년 전 조회 823
10년 전 조회 1,072
10년 전 조회 916
10년 전 조회 866
10년 전 조회 883
10년 전 조회 841
10년 전 조회 786
10년 전 조회 744
10년 전 조회 825
10년 전 조회 854
10년 전 조회 818
10년 전 조회 746
10년 전 조회 822
10년 전 조회 804
10년 전 조회 815
10년 전 조회 875
10년 전 조회 882
10년 전 조회 794
10년 전 조회 833
10년 전 조회 895
10년 전 조회 913
10년 전 조회 924
10년 전 조회 858
10년 전 조회 790
10년 전 조회 774
10년 전 조회 799
10년 전 조회 775
10년 전 조회 785
10년 전 조회 829
10년 전 조회 765
10년 전 조회 808
10년 전 조회 787
10년 전 조회 867
10년 전 조회 985
10년 전 조회 924
10년 전 조회 891
10년 전 조회 795
10년 전 조회 914
10년 전 조회 809
10년 전 조회 854
10년 전 조회 798
10년 전 조회 794
10년 전 조회 769
10년 전 조회 796
10년 전 조회 898
10년 전 조회 838
10년 전 조회 938