휴대폰번호 검사

· 17년 전 · 2027

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


 

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

프로그램

+
제목 글쓴이 날짜 조회
16년 전 조회 6,343
17년 전 조회 2,357
17년 전 조회 4,125
17년 전 조회 1,893
17년 전 조회 2,192
17년 전 조회 2,540
17년 전 조회 3,058
17년 전 조회 2,758
17년 전 조회 3,192
17년 전 조회 3,438
17년 전 조회 3,460
17년 전 조회 2,270
17년 전 조회 1,982
17년 전 조회 1,856
17년 전 조회 2,180
17년 전 조회 1,659
17년 전 조회 2,416
17년 전 조회 2,192
17년 전 조회 2,038
17년 전 조회 1,736
17년 전 조회 2,608
17년 전 조회 3,686
17년 전 조회 2,572
17년 전 조회 2,188
17년 전 조회 1,956
17년 전 조회 2,488
17년 전 조회 5,183
17년 전 조회 1,877
17년 전 조회 2,616
17년 전 조회 2,584
17년 전 조회 2,864
17년 전 조회 2,579
17년 전 조회 4,910
17년 전 조회 3,406
17년 전 조회 3,316
17년 전 조회 2,036
17년 전 조회 1,698
17년 전 조회 4,424
17년 전 조회 2,091
17년 전 조회 2,091
17년 전 조회 2,581
17년 전 조회 2,331
17년 전 조회 1,963
17년 전 조회 4,374
17년 전 조회 2,197
17년 전 조회 3,553
17년 전 조회 3,473
17년 전 조회 1,465
17년 전 조회 2,248
17년 전 조회 2,028
17년 전 조회 2,277
17년 전 조회 3,086
17년 전 조회 3,445
17년 전 조회 3,651
17년 전 조회 3,770
17년 전 조회 1,863
17년 전 조회 1,862
17년 전 조회 2,667
17년 전 조회 2,417
17년 전 조회 2,698
17년 전 조회 3,245
17년 전 조회 3,703
17년 전 조회 2,789
17년 전 조회 2,064
17년 전 조회 3,635
17년 전 조회 3,502
17년 전 조회 3,458
17년 전 조회 4,338
17년 전 조회 2,989
17년 전 조회 2,839
17년 전 조회 3,097
17년 전 조회 3,311
17년 전 조회 3,039
17년 전 조회 1,902
17년 전 조회 2,296
17년 전 조회 1,945
17년 전 조회 2,350
17년 전 조회 2,966
17년 전 조회 9,123
17년 전 조회 3,576
17년 전 조회 4,626
17년 전 조회 2,395
17년 전 조회 4,055
17년 전 조회 1,953
17년 전 조회 1,794
17년 전 조회 2,728
17년 전 조회 1,711
17년 전 조회 2,039
17년 전 조회 1,901
17년 전 조회 2,945
17년 전 조회 1,911
17년 전 조회 1,487
17년 전 조회 1,642
17년 전 조회 3,556
17년 전 조회 2,588
17년 전 조회 2,381
17년 전 조회 1,637
17년 전 조회 2,862
17년 전 조회 1,577
17년 전 조회 1,552