메뉴 건너뛰기

2014.03.01 21:55

check_inputbox.js

조회 수 5951 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
/*-------------------------------------------------------------------------------*/
/*
한글의 경우 키 입력시 바로바로 작업이 안되기 때문에
onchange 와 onblur 등 이벤트도 같이 등록.
*/
 // 한글만 입력받기 (초성체 무시)
// 나머지 글자 무시
function nr_han(this_s,type){
    /*
    type
    -> 'c' : 초성 포함
    -> 's' : 초성 포함 + 공백 포함
    -> '' : 초성, 공백 무시
    */
    temp_value = this_s.value.toString();
    regexp = '';
    repexp = '';
    switch(type){
        case 'c': regexp = /[^ㄱ-ㅎ가-�R]/g;break;
        case 's': regexp = /[^ㄱ-ㅎ가-�R\s]/g;break;
        case '':    regexp = /[^가-�R]/g; break;
        default : regexp = /[^ㄱ-ㅎ가-�R\s]/g;
    }
    if(regexp.test(temp_value))
    {
        temp_value = temp_value.replace(regexp,repexp);
        this_s.value = temp_value;
    }
}
   
 /*-------------------------------------------------------------------------------*/
 // 한글만 입력받기 (초성체 포함)
// 나머지 글자 무시
function nr_han_cho(this_s){
 nr_han(this_s,'c');
}
 /*-------------------------------------------------------------------------------*/
 // 한글만 입력받기 (초성체 포함, 공백 포함)
// 나머지 글자 무시
function nr_han_cho_space(this_s){
 nr_han(this_s,'s');
}
 
/*-------------------------------------------------------------------------------*/
function nr_numeng(this_s){
 temp_value = this_s.value.toString();
 regexp = /[^0-9a-zA-Z]/g;
 repexp = '';
 temp_value = temp_value.replace(regexp,repexp);
 this_s.value = temp_value;
}
 /*-------------------------------------------------------------------------------*/
// 나머지 글자 무시
function nr_num(this_s,type){
 /*
 type
 -> 'int' : 양의 정수
 -> 'float' : 양의 실수
 -> '-int' : 음의 정수 포함
 -> '-int' : 음의 실수 포함
 */
 temp_value = this_s.value.toString();
 regexp = /[^-\.0-9]/g;
 repexp = '';
 temp_value = temp_value.replace(regexp,repexp);
 regexp = '';
 repexp = '';
 switch(type){
  case 'int':  regexp = /[^0-9]/g; break;
  case 'float':regexp = /^(-?)([0-9]*)(\.?)([^0-9]*)([0-9]*)([^0-9]*)/; break;
  case '-int': regexp = /^(-?)([0-9]*)([^0-9]*)([0-9]*)([^0-9]*)/;break;
  case '-float':regexp = /^(-?)([0-9]*)(\.?)([^0-9]*)([0-9]*)([^0-9]*)/; break;
  default : regexp = /[^0-9]/g; break;
 }
 switch(type){
  case 'int':repexp = '';break;
  case 'float':repexp = '$2$3$5';break;
  case '-int': repexp = '$1$2$4';break;
  case '-float':repexp = '$1$2$3$5'; break;
  default : regexp = /[^0-9]/g; break;
 }
 temp_value = temp_value.replace(regexp,repexp);
 this_s.value = temp_value;
}
// 양의 정수만 입력받기
function nr_num_int(this_s){
 nr_num(this_s,'int');
}
// 양의 실수만 입력받기
function nr_num_float(this_s){
 nr_num(this_s,'float');
}
 /*-------------------------------------------------------------------------------*/
 // 영어만 입력받기  (대소문자)
// 나머지 글자 무시
function nr_eng(this_s,type){
 temp_value = this_s.value.toString();
 regexp = '';
 repexp = '';
 switch(type){
  case 'small':regexp = /[^a-z]/g;break;
  case 'big':regexp = /[^A-Z]/g;break;
  case 'all':regexp = /[^a-z]/i;break;
  default :regexp = /[^a-z]/i;break;
 }
 temp_value = temp_value.replace(regexp,repexp);
 this_s.value = temp_value;
}
 // 영어만 입력받기  (소문자)
// 나머지 글자 무시
function nr_eng_small(this_s){
 nr_eng(this_s,'small');
}
 // 영어만 입력받기  (대문자)
// 나머지 글자 무시
function nr_eng_big(this_s){
 nr_eng(this_s,'big');
}
 /*-------------------------------------------------------------------------------*/
 
// 주민등록 번호 규격에 맞게 123456-1234567  //검증하지 않음.
// 나머지 글자 무시
function nr_jumin(this_s){
 temp_value = this_s.value.toString();
 temp_value = temp_value.replace(/[^0-9]/g,'');
 temp_value = temp_value.substr(0,13);
 temp_value = temp_value.replace(/([0-9]{6})([0-9]{7}$)/,"$1-$2");
 this_s.value = temp_value;
}
   
 /*-------------------------------------------------------------------------------*/
 // 사업자 등록 번호 규격에 맞게 123-12-12345  //검증하지 않음.
// 나머지 글자 무시
function nr_company_num(this_s){
 temp_value = this_s.value.toString();
 temp_value = temp_value.replace(/[^0-9]/g,'');
 temp_value = temp_value.substr(0,10);
 temp_value = temp_value.replace(/([0-9]{3})([0-9]{2})([0-9]{5}$)/,"$1-$2-$3");
 this_s.value = temp_value;
}
 /*-------------------------------------------------------------------------------*/
 /*
 * 숫자와 - 만 사용가능
 */
function  nr_hyphen_num(this_s){
 temp_value = this_s.value.toString();
 temp_value = temp_value.replace(/[^0-9^-]/g,'');
 this_s.value = temp_value;
}
 function  nr_tel_num(this_s){
 temp_value = this_s.value.toString();
 temp_value = temp_value.replace(/[^0-9^-]/g,'');
 this_s.value = temp_value;
}
/*
// 관리자 번호 앞에 9자리 삭제
function nr_Adminno_Cut(adminno)
{
 if(adminno.length != 19)
  return adminno
  adminno = adminno.substr(9, 10);
  
 return adminno;
}
*/
 // 관리자 번호 앞에 9자리 삭제
function nr_Adminno_Cut(adminno)
{
 if(adminno.length != 20)
  return adminno
  adminno = adminno.substr(9, 10);
  
 return adminno;
}
 /*
// 날짜에 - 추가
function nr_Date_Paste(date)
{
 if(date.length != 8)
  return date;
  date = date.substr(0, 4) + "-" + date.substr(4, 2) + "-" + date.substr(6, 2);
  
 return date;
}
*/
 // 날짜에 - 삭제
function nr_Date_Cut(date)
{
 if(adminno.length != 8)
  return date
  date = date.substr(0, 4) + "-" + date.substr(5, 2) + "-" + date.substr(7, 2);
  
 return date;
}
 
// 날짜에 - 삭제
function nr_Date_Cut(date)
{
 if(date.length != 10)
  return date;
  date = date.substr(0, 4) + date.substr(5, 2) + date.substr(8, 2);
  
 return date;
}
 
// ,추가
function comma_paste(this_s)
{
 fvalue = this_s.value.toString();
  
    fvaluenum = fvalue.length;
     
    if(fvaluenum>3){
        comma=Math.ceil(fvaluenum/3)-1;
        substart = 0;
         for(x=comma; x>=0; x--){
            sublast = fvaluenum-(x*3);
   
            val=fvalue.substring(substart, sublast);
            substart = sublast;
             if(x==comma) vall = val + ',';
            else if(x==0) vall = vall + val;
            else vall = vall + val + ',';
        }
         
        this_s.value = vall;
    }
    else
    {
        this_s.value = fvalue;
    }
}
 // , 제거함수
function comma_cut(this_s)
{
 restring = this_s.value.toString();
  
    if(restring.search(',')){
        exp=restring.split(',');
        for(t=0 ; ; t++){
            if(!exp[t]) break;
 
            if(t==0){
                restring = exp[t];
            } else {
                restring = restring + exp[t];
            }
        }
    }
     
    this_s.value = restring;
}
 
// 정해진 숫자 길이를 넘기면 다음포커스로 이동
function count_check(this_s, this_e, cnt)
{
 nr_num_int(this_s);
  
 restring = this_s.value.toString();
  
 if(restring.length >= cnt)
 {
  this_e.focus();
 }
}

  1. 이미지클릭시 옆에 큰이미지나오기

    Date2014.03.17 Views5789
    Read More
  2. 따라다니는 배너

    Date2014.03.17 Views6534
    Read More
  3. 입력된 글씨수 제어

    Date2014.03.01 Views7007
    Read More
  4. select 당일 날짜 출력

    Date2014.03.01 Views6177
    Read More
  5. 입력된 폼의 내용 똑같이 복사

    Date2014.03.01 Views7146
    Read More
  6. 해상도에 따라 배경 바꾸기

    Date2014.03.01 Views6359
    Read More
  7. input 빈칸 체크

    Date2014.03.01 Views6533
    Read More
  8. 선택된 select 의 option 값을 다른 select로 넘겨주기

    Date2014.03.01 Views5943
    Read More
  9. checkbox 한개 클릭으로 다른모든 checkbox 클릭되게 하기

    Date2014.03.01 Views6019
    Read More
  10. 자바 스크립트 confirm()함수에서 (확인,취소) -> (예,아니오)

    Date2014.03.01 Views10507
    Read More
  11. 제목에 한글 영문 숫자 와 공란만 입력하게 하고 싶습니다.

    Date2014.03.01 Views6741
    Read More
  12. input type checkbox 체크했는지 검사하는 소스

    Date2014.03.01 Views5814
    Read More
  13. check_inputbox.js

    Date2014.03.01 Views5951
    Read More
  14. Textarea 글자수 체크

    Date2014.03.01 Views5924
    Read More
  15. 라디오 버튼 체크

    Date2014.03.01 Views5726
    Read More
  16. iframe 높이 자동으로 잡아주기

    Date2014.03.01 Views6165
    Read More
  17. 영문, 숫자, 한글, 이메일 체크 하는 함수

    Date2014.03.01 Views5544
    Read More
  18. iframe을 리로드 하자!

    Date2014.03.01 Views6170
    Read More
  19. 이미지나 태그정렬이 안맞을때 absmiddle

    Date2014.03.01 Views5522
    Read More
  20. form 값 iframe 으로 넘기기

    Date2014.03.01 Views7222
    Read More
Board Pagination Prev 1 ... 4 5 6 7 8 9 10 11 12 13 Next
/ 13

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

나눔고딕 사이트로 가기

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5