휴대폰번호 검사

· 17년 전 · 1601

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


 

[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
16년 전 조회 5,879
16년 전 조회 1,925
16년 전 조회 3,690
16년 전 조회 1,474
16년 전 조회 1,762
16년 전 조회 2,076
16년 전 조회 2,619
16년 전 조회 2,317
16년 전 조회 2,757
16년 전 조회 3,001
16년 전 조회 3,021
16년 전 조회 1,824
16년 전 조회 1,550
16년 전 조회 1,419
16년 전 조회 1,733
16년 전 조회 1,215
16년 전 조회 1,974
16년 전 조회 1,746
16년 전 조회 1,619
16년 전 조회 1,304
16년 전 조회 2,179
16년 전 조회 3,239
16년 전 조회 2,169
16년 전 조회 1,748
16년 전 조회 1,516
16년 전 조회 2,051
17년 전 조회 4,737
17년 전 조회 1,420
17년 전 조회 2,158
17년 전 조회 2,139
17년 전 조회 2,411
17년 전 조회 2,159
17년 전 조회 4,443
17년 전 조회 2,940
17년 전 조회 2,875
17년 전 조회 1,608
17년 전 조회 1,248
17년 전 조회 3,954
17년 전 조회 1,627
17년 전 조회 1,619
17년 전 조회 2,123
17년 전 조회 1,890
17년 전 조회 1,505
17년 전 조회 3,925
17년 전 조회 1,763
17년 전 조회 3,137
17년 전 조회 3,016
17년 전 조회 1,048
17년 전 조회 1,857
17년 전 조회 1,602
17년 전 조회 1,859
17년 전 조회 2,651
17년 전 조회 3,033
17년 전 조회 3,227
17년 전 조회 3,334
17년 전 조회 1,469
17년 전 조회 1,427
17년 전 조회 2,263
17년 전 조회 1,986
17년 전 조회 2,300
17년 전 조회 2,824
17년 전 조회 3,274
17년 전 조회 2,371
17년 전 조회 1,642
17년 전 조회 3,214
17년 전 조회 3,078
17년 전 조회 3,054
17년 전 조회 3,922
17년 전 조회 2,597
17년 전 조회 2,417
17년 전 조회 2,666
17년 전 조회 2,904
17년 전 조회 2,618
17년 전 조회 1,463
17년 전 조회 1,908
17년 전 조회 1,500
17년 전 조회 1,922
17년 전 조회 2,521
17년 전 조회 8,702
17년 전 조회 3,163
17년 전 조회 4,254
17년 전 조회 1,989
17년 전 조회 3,668
17년 전 조회 1,563
17년 전 조회 1,396
17년 전 조회 2,331
17년 전 조회 1,326
17년 전 조회 1,641
17년 전 조회 1,475
17년 전 조회 2,543
17년 전 조회 1,508
17년 전 조회 1,099
17년 전 조회 1,232
17년 전 조회 3,108
17년 전 조회 2,174
17년 전 조회 1,980
17년 전 조회 1,224
17년 전 조회 2,456
17년 전 조회 1,178
17년 전 조회 1,138
🐛 버그신고