금액 입력시 자동으로 천단위구분기호(,) 붙여주는 함수
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에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 4877 |
|
13년 전 | 2900 | |
| 4876 | 13년 전 | 2378 | ||
| 4875 | 13년 전 | 1975 | ||
| 4874 | 13년 전 | 3768 | ||
| 4873 | 13년 전 | 2077 | ||
| 4872 |
PHPㅡASP프로그래머
|
13년 전 | 1807 | |
| 4871 |
PHPㅡASP프로그래머
|
13년 전 | 1493 | |
| 4870 |
PHPㅡASP프로그래머
|
13년 전 | 1276 | |
| 4869 |
PHPㅡASP프로그래머
|
13년 전 | 1208 | |
| 4868 |
PHPㅡASP프로그래머
|
13년 전 | 4436 | |
| 4867 |
Darby
|
13년 전 | 1612 | |
| 4866 | 13년 전 | 773 | ||
| 4865 | 13년 전 | 848 | ||
| 4864 | 13년 전 | 1512 | ||
| 4863 | 13년 전 | 1414 | ||
| 4862 | 13년 전 | 4263 | ||
| 4861 | 13년 전 | 1043 | ||
| 4860 | 13년 전 | 2691 | ||
| 4859 | 13년 전 | 1260 | ||
| 4858 | 13년 전 | 1635 | ||
| 4857 | 13년 전 | 1271 | ||
| 4856 | 13년 전 | 1919 | ||
| 4855 | 13년 전 | 13173 | ||
| 4854 | 13년 전 | 1188 | ||
| 4853 |
AMDbest
|
13년 전 | 4334 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기