금액 입력시 자동으로 천단위구분기호(,) 붙여주는 함수
function checkNumber(decimals,dec_point,thousands_sep){
var objEv = event.srcElement;
var numPattern = /([^0-9,-,\,])/;
numPattern = objEv.value.match(numPattern);
if(numPattern != null){
alert("숫자로 입력해주십시오.");
objEv.value="";
objEv.focus();
return false;
}
if(objEv.value.indexOf('-') > 1){
alert("숫자로 입력해주십시오.");
objEv.value="";
objEv.focus();
return false;
}
if(decimals==null){decimals=999;}
if(dec_point==null){dec_point='.';}
if(thousands_sep==null){thousands_sep=',';}
var arr = objEv.value.toString().replace(/[^-\.\+\d]/g,'').split(dec_point);
arr[0] = arr[0].replace(/(\d)(?=(?:\d{3})+(?!\d))/g,'$1'+thousands_sep);
if(arr[1] && decimals>0 && arr[1].length>0){
objEv.value= arr[0] + dec_point + arr[1];
return true;
} else{
objEv.value= arr[0];
return true;
}
}
var objEv = event.srcElement;
var numPattern = /([^0-9,-,\,])/;
numPattern = objEv.value.match(numPattern);
if(numPattern != null){
alert("숫자로 입력해주십시오.");
objEv.value="";
objEv.focus();
return false;
}
if(objEv.value.indexOf('-') > 1){
alert("숫자로 입력해주십시오.");
objEv.value="";
objEv.focus();
return false;
}
if(decimals==null){decimals=999;}
if(dec_point==null){dec_point='.';}
if(thousands_sep==null){thousands_sep=',';}
var arr = objEv.value.toString().replace(/[^-\.\+\d]/g,'').split(dec_point);
arr[0] = arr[0].replace(/(\d)(?=(?:\d{3})+(?!\d))/g,'$1'+thousands_sep);
if(arr[1] && decimals>0 && arr[1].length>0){
objEv.value= arr[0] + dec_point + arr[1];
return true;
} else{
objEv.value= arr[0];
return true;
}
}
게시판 목록
팁게시판
디자인과 관련된 유용한 정보를 공유하세요.
질문은 상단의 QA에서 해주시기 바랍니다.
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5302 | 12년 전 | 1619 | ||
| 5301 |
냐옹이사범
|
12년 전 | 2325 | |
| 5300 | 12년 전 | 6531 | ||
| 5299 | 12년 전 | 5212 | ||
| 5298 | 12년 전 | 3021 | ||
| 5297 |
프로프리랜서
|
12년 전 | 2542 | |
| 5296 |
프로프리랜서
|
12년 전 | 1901 | |
| 5295 |
프로프리랜서
|
12년 전 | 2365 | |
| 5294 |
프로프리랜서
|
12년 전 | 1866 | |
| 5293 |
프로프리랜서
|
12년 전 | 1643 | |
| 5292 |
프로프리랜서
|
12년 전 | 5540 | |
| 5291 |
프로프리랜서
|
12년 전 | 2610 | |
| 5290 |
프로프리랜서
|
12년 전 | 3073 | |
| 5289 |
프로프리랜서
|
12년 전 | 1748 | |
| 5288 |
프로프리랜서
|
12년 전 | 1468 | |
| 5287 | 12년 전 | 2766 | ||
| 5286 |
오늘도망했다
|
12년 전 | 2352 | |
| 5285 |
오늘도망했다
|
12년 전 | 1692 | |
| 5284 |
오늘도망했다
|
12년 전 | 6650 | |
| 5283 |
오늘도망했다
|
12년 전 | 2527 | |
| 5282 | 12년 전 | 3658 | ||
| 5281 |
jinmuk
|
12년 전 | 1466 | |
| 5280 |
jinmuk
|
12년 전 | 4241 | |
| 5279 |
jinmuk
|
12년 전 | 5563 | |
| 5278 |
jinmuk
|
12년 전 | 2273 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기