휴대폰번호 검사

· 17년 전 · 1598

<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,876
16년 전 조회 1,920
16년 전 조회 3,689
16년 전 조회 1,473
16년 전 조회 1,761
16년 전 조회 2,073
16년 전 조회 2,618
16년 전 조회 2,315
16년 전 조회 2,753
16년 전 조회 2,998
16년 전 조회 3,019
16년 전 조회 1,823
16년 전 조회 1,547
16년 전 조회 1,417
16년 전 조회 1,731
16년 전 조회 1,213
16년 전 조회 1,972
16년 전 조회 1,743
16년 전 조회 1,618
16년 전 조회 1,301
16년 전 조회 2,177
16년 전 조회 3,236
16년 전 조회 2,167
16년 전 조회 1,746
16년 전 조회 1,514
16년 전 조회 2,050
16년 전 조회 4,733
17년 전 조회 1,420
17년 전 조회 2,158
17년 전 조회 2,137
17년 전 조회 2,410
17년 전 조회 2,156
17년 전 조회 4,442
17년 전 조회 2,936
17년 전 조회 2,873
17년 전 조회 1,607
17년 전 조회 1,245
17년 전 조회 3,954
17년 전 조회 1,626
17년 전 조회 1,616
17년 전 조회 2,119
17년 전 조회 1,887
17년 전 조회 1,504
17년 전 조회 3,924
17년 전 조회 1,761
17년 전 조회 3,135
17년 전 조회 3,013
17년 전 조회 1,046
17년 전 조회 1,856
17년 전 조회 1,599
17년 전 조회 1,858
17년 전 조회 2,649
17년 전 조회 3,030
17년 전 조회 3,226
17년 전 조회 3,333
17년 전 조회 1,467
17년 전 조회 1,426
17년 전 조회 2,261
17년 전 조회 1,984
17년 전 조회 2,295
17년 전 조회 2,822
17년 전 조회 3,270
17년 전 조회 2,370
17년 전 조회 1,639
17년 전 조회 3,211
17년 전 조회 3,077
17년 전 조회 3,051
17년 전 조회 3,920
17년 전 조회 2,594
17년 전 조회 2,414
17년 전 조회 2,665
17년 전 조회 2,901
17년 전 조회 2,618
17년 전 조회 1,461
17년 전 조회 1,906
17년 전 조회 1,496
17년 전 조회 1,922
17년 전 조회 2,520
17년 전 조회 8,701
17년 전 조회 3,162
17년 전 조회 4,250
17년 전 조회 1,987
17년 전 조회 3,667
17년 전 조회 1,559
17년 전 조회 1,392
17년 전 조회 2,331
17년 전 조회 1,323
17년 전 조회 1,639
17년 전 조회 1,474
17년 전 조회 2,539
17년 전 조회 1,506
17년 전 조회 1,097
17년 전 조회 1,232
17년 전 조회 3,107
17년 전 조회 2,170
17년 전 조회 1,978
17년 전 조회 1,222
17년 전 조회 2,455
17년 전 조회 1,175
17년 전 조회 1,135
🐛 버그신고