<HTML>
<HEAD>
<TITLE>금액 출력</TITLE>
<SCRIPT Language='JavaScript'>
//금액에 , 찍기
function numchk(num){
num=new String(num);
num=num.replace(/,/gi,"");
return numchk1(num);
}
function numchk1(num){
var sign="";
if(isNaN(num)) {
alert("숫자만 입력할 수 있습니다.");
return 0;
}
if(num==0) {
return num;
}
if(num<0){
num=num*(-1);
sign="-";
}
else{
num=num*1;
}
num = new String(num)
var temp="";
var pos=3;
num_len=num.length;
while (num_len>0){
num_len=num_len-pos;
if(num_len<0) {
pos=num_len+pos;
num_len=0;
}
temp=","+num.substr(num_len,pos)+temp;
}
return sign+temp.substr(1);
}
// 금액 숫자를 한글로
function num_han(num)
{
if ( num == "1" ) return "일";
else if ( num == "2" ) return "이";
else if ( num == "3" ) return "삼";
else if ( num == "4" ) return "사";
else if ( num == "5" ) return "오";
else if ( num == "6" ) return "육";
else if ( num == "7" ) return "칠";
else if ( num == "8" ) return "팔";
else if ( num == "9" ) return "구";
else if ( num == "십" ) return "십";
else if ( num == "백" ) return "백";
else if ( num == "천" ) return "천";
else if ( num == "만" ) return "만 ";
else if ( num == "억" ) return "억 ";
else if ( num == "조" ) return "조 ";
else if ( num == "0" ) return "";
}
function NUM_HAN(num,mode,return_input)
{
if ( num == "" || num == "0" ) {
if ( mode == "3" ) {
return_input.value = "";
}
return;
}
num=new String(num);
num=num.replace(/,/gi,"");
var len = num.length;
var temp1 = "";
var temp2 = "";
if ( len/4 > 3 && len/4 <= 4 ) {
if ( len%4 == 0 ) {
temp1 = ciphers_han(num.substring(0,4)) + "조" + ciphers_han(num.substring(4,8)) + "억" + ciphers_han(num.substring(8,12)) + "만" + ciphers_han(num.substring(12,16));
}
else {
temp1 = ciphers_han(num.substring(0,len%4)) + "조" + ciphers_han(num.substring(len%4,len%4+4)) + "억" + ciphers_han(num.substring(len%4+4,len%4+8)) + "만" + ciphers_han(num.substring(len%4+8,len%4+12));
}
}
else if ( len/4 > 2 && len/4 <= 3 ) {
if ( len%4 == 0 ) {
temp1 = ciphers_han(num.substring(0,4)) + "억" + ciphers_han(num.substring(4,8)) + "만" + ciphers_han(num.substring(8,12));
}
else {
temp1 = ciphers_han(num.substring(0,len%4)) + "억" + ciphers_han(num.substring(len%4,len%4+4)) + "만" + ciphers_han(num.substring(len%4+4,len%4+8));
}
}
else if ( len/4 > 1 && len/4 <= 2 ) {
if ( len%4 == 0 ) {
temp1 = ciphers_han(num.substring(0,4)) + "만" + ciphers_han(num.substring(4,len));
}
else {
temp1 = ciphers_han(num.substring(0,len%4)) + "만" + ciphers_han(num.substring(len%4,len));
}
}
else if ( len/4 <= 1 ) {
temp1 = ciphers_han(num.substring(0,len));
}
for (var i=0; i<temp1.length; i++) {
temp2 = temp2 + num_han(temp1.substring(i, i+1));
}
temp3=new String(temp2);
temp3=temp3.replace(/억 만/gi,"억 ");
temp3=temp3.replace(/조 억/gi,"조 ");
if ( mode == 1 ) {
alert(temp3 + " 원");
} else if ( mode == 2 ) {
return temp3;
} else if ( mode == 3 ) {
return_input.value = "( " + temp3 + " 원 )";
}
}
function ciphers_han(num)
{
var len = num.length;
var temp = "";
if ( len == 1 ) {
temp = num;
}
else if ( len == 2 ) {
temp = num.substring(0,1) + "십" + num.substring(1,2);
}
else if ( len == 3 ) {
temp = num.substring(0,1) + "백" + num.substring(1,2) + "십" + num.substring(2,3);
}
else if ( len == 4 ) {
temp = num.substring(0,1) + "천" + num.substring(1,2) + "백" + num.substring(2,3) + "십" + num.substring(3,4);
}
num=new String(temp);
num=num.replace(/0십/gi,"");
num=num.replace(/0백/gi,"");
num=num.replace(/0천/gi,"");
return num;
}
function moncom(mon) {
var factor = mon.length % 3;
var su = (mon.length - factor) / 3;
var com = mon.substring(0,factor);
for(var i=0; i < su ; i++) {
if((factor == 0) && (i == 0)) {
com += mon.substring(factor+(3*i), factor+3+(3*i));
}
else {
com += "," ;
com += mon.substring(factor+(3*i), factor+3+(3*i));
}
}
document.write(com);
}
</SCRIPT>
</HEAD>
<body>
금액<form name=form action=# method=get>
<input type="text" name="A_EMONEY" size=18 maxLength=15 style="text-align:right" onkeypress="NUM_HAN(this.value,3,document.form.EMONEY_HAN)" onkeyup="this.value=numchk(this.value);NUM_HAN(this.value,3,document.form.EMONEY_HAN)"> 원
<input type="text" name="EMONEY_HAN" readonly style="border:0;" size="50">
</form>
</body>
</html><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>
<HEAD>
<TITLE>금액 출력</TITLE>
<SCRIPT Language='JavaScript'>
//금액에 , 찍기
function numchk(num){
num=new String(num);
num=num.replace(/,/gi,"");
return numchk1(num);
}
function numchk1(num){
var sign="";
if(isNaN(num)) {
alert("숫자만 입력할 수 있습니다.");
return 0;
}
if(num==0) {
return num;
}
if(num<0){
num=num*(-1);
sign="-";
}
else{
num=num*1;
}
num = new String(num)
var temp="";
var pos=3;
num_len=num.length;
while (num_len>0){
num_len=num_len-pos;
if(num_len<0) {
pos=num_len+pos;
num_len=0;
}
temp=","+num.substr(num_len,pos)+temp;
}
return sign+temp.substr(1);
}
// 금액 숫자를 한글로
function num_han(num)
{
if ( num == "1" ) return "일";
else if ( num == "2" ) return "이";
else if ( num == "3" ) return "삼";
else if ( num == "4" ) return "사";
else if ( num == "5" ) return "오";
else if ( num == "6" ) return "육";
else if ( num == "7" ) return "칠";
else if ( num == "8" ) return "팔";
else if ( num == "9" ) return "구";
else if ( num == "십" ) return "십";
else if ( num == "백" ) return "백";
else if ( num == "천" ) return "천";
else if ( num == "만" ) return "만 ";
else if ( num == "억" ) return "억 ";
else if ( num == "조" ) return "조 ";
else if ( num == "0" ) return "";
}
function NUM_HAN(num,mode,return_input)
{
if ( num == "" || num == "0" ) {
if ( mode == "3" ) {
return_input.value = "";
}
return;
}
num=new String(num);
num=num.replace(/,/gi,"");
var len = num.length;
var temp1 = "";
var temp2 = "";
if ( len/4 > 3 && len/4 <= 4 ) {
if ( len%4 == 0 ) {
temp1 = ciphers_han(num.substring(0,4)) + "조" + ciphers_han(num.substring(4,8)) + "억" + ciphers_han(num.substring(8,12)) + "만" + ciphers_han(num.substring(12,16));
}
else {
temp1 = ciphers_han(num.substring(0,len%4)) + "조" + ciphers_han(num.substring(len%4,len%4+4)) + "억" + ciphers_han(num.substring(len%4+4,len%4+8)) + "만" + ciphers_han(num.substring(len%4+8,len%4+12));
}
}
else if ( len/4 > 2 && len/4 <= 3 ) {
if ( len%4 == 0 ) {
temp1 = ciphers_han(num.substring(0,4)) + "억" + ciphers_han(num.substring(4,8)) + "만" + ciphers_han(num.substring(8,12));
}
else {
temp1 = ciphers_han(num.substring(0,len%4)) + "억" + ciphers_han(num.substring(len%4,len%4+4)) + "만" + ciphers_han(num.substring(len%4+4,len%4+8));
}
}
else if ( len/4 > 1 && len/4 <= 2 ) {
if ( len%4 == 0 ) {
temp1 = ciphers_han(num.substring(0,4)) + "만" + ciphers_han(num.substring(4,len));
}
else {
temp1 = ciphers_han(num.substring(0,len%4)) + "만" + ciphers_han(num.substring(len%4,len));
}
}
else if ( len/4 <= 1 ) {
temp1 = ciphers_han(num.substring(0,len));
}
for (var i=0; i<temp1.length; i++) {
temp2 = temp2 + num_han(temp1.substring(i, i+1));
}
temp3=new String(temp2);
temp3=temp3.replace(/억 만/gi,"억 ");
temp3=temp3.replace(/조 억/gi,"조 ");
if ( mode == 1 ) {
alert(temp3 + " 원");
} else if ( mode == 2 ) {
return temp3;
} else if ( mode == 3 ) {
return_input.value = "( " + temp3 + " 원 )";
}
}
function ciphers_han(num)
{
var len = num.length;
var temp = "";
if ( len == 1 ) {
temp = num;
}
else if ( len == 2 ) {
temp = num.substring(0,1) + "십" + num.substring(1,2);
}
else if ( len == 3 ) {
temp = num.substring(0,1) + "백" + num.substring(1,2) + "십" + num.substring(2,3);
}
else if ( len == 4 ) {
temp = num.substring(0,1) + "천" + num.substring(1,2) + "백" + num.substring(2,3) + "십" + num.substring(3,4);
}
num=new String(temp);
num=num.replace(/0십/gi,"");
num=num.replace(/0백/gi,"");
num=num.replace(/0천/gi,"");
return num;
}
function moncom(mon) {
var factor = mon.length % 3;
var su = (mon.length - factor) / 3;
var com = mon.substring(0,factor);
for(var i=0; i < su ; i++) {
if((factor == 0) && (i == 0)) {
com += mon.substring(factor+(3*i), factor+3+(3*i));
}
else {
com += "," ;
com += mon.substring(factor+(3*i), factor+3+(3*i));
}
}
document.write(com);
}
</SCRIPT>
</HEAD>
<body>
금액<form name=form action=# method=get>
<input type="text" name="A_EMONEY" size=18 maxLength=15 style="text-align:right" onkeypress="NUM_HAN(this.value,3,document.form.EMONEY_HAN)" onkeyup="this.value=numchk(this.value);NUM_HAN(this.value,3,document.form.EMONEY_HAN)"> 원
<input type="text" name="EMONEY_HAN" readonly style="border:0;" size="50">
</form>
</body>
</html><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>
게시글 목록
| 번호 | 제목 |
|---|---|
| 11111 | |
| 11108 | |
| 11107 | |
| 11105 |
JavaScript
이미지 저작권 관련 설명 1탄
1
|
| 11101 |
Flash
초간단 플래시테두리 없애는 방법입니다.
3
|
| 11099 |
JavaScript
직접만든 자바스크립트 Trim 함수입니다.
1
|
| 11095 | |
| 11093 | |
| 24843 | |
| 11065 | |
| 11063 | |
| 11059 |
JavaScript
PHP Ajax 프레임워크
3
|
| 29001 | |
| 11054 |
JavaScript
일반PC로 서버 만들경우....
4
|
| 28999 | |
| 11050 | |
| 28998 |
HTML
mshtml.dll error 발생시
|
| 28956 | |
| 11044 | |
| 11023 |
JavaScript
[입문자용 강좌] 상수?
20
|
| 11004 | |
| 28946 |
HTML
[입문자용강좌] 변수란?
9
|
| 10993 | |
| 10990 | |
| 28903 | |
| 10984 | |
| 24842 |
계약서
고용계약서
|
| 28900 |
HTML
marquee 태그 활용법
2
|
| 10982 | |
| 10978 |
JavaScript
실제 이미지 크기 알아내기
3
|
| 28899 | |
| 10974 |
Flash
플래쉬 투명바탕 어떻게 하는거죠?
3
|
| 10970 | |
| 24831 | |
| 24830 |
계약서
표준임대차 계약서
|
| 10967 |
JavaScript
ie,firefox alpha값
2
|
| 10965 | |
| 10963 | |
| 10956 |
JavaScript
왕초보 소스 중 질문있어요...^^;
6
|
| 10954 |
Flash
플래시 그림판 소스 입니다.
1
|
| 10950 |
Flash
[펌]겔러리에 적용하면 괜찮은 소스
3
|
| 10946 | |
| 24818 |
견적서
홈페이지 견적서입니다
11
|
| 10943 |
Flash
플래시 활성화 영역 안나오게 하기...
2
|
| 28885 |
JavaScript
외부의 이미지를 자신의 서버경로에 썸네일 만드는 방법
13
|
| 24813 | |
| 10940 | |
| 10927 |
JavaScript
포토샵질문드려요.
12
|
| 10925 |
Flash
FLEX 참고자료 URL
1
|
| 10920 |
JavaScript
이동도구(v)팁
4
|
| 10916 | |
| 10914 | |
| 10913 |
기타
FLEX 란?
|
| 10908 |
Flash
플래시 플레이어 오류발생할 때 패치
4
|
| 10905 | |
| 10904 | |
| 10899 | |
| 24803 | |
| 28882 |
HTML
링크클릭시 나타나는 점선 없애주기
2
|
| 10898 |
Flash
간단한 퀵메뉴
|
| 28878 |
기타
Ajax 마스터하기
3
|
| 28877 | |
| 24802 | |
| 24801 | |
| 24800 | |
| 24799 | |
| 10893 | |
| 10892 | |
| 24797 | |
| 24794 | |
| 10891 |
Flash
정상적인 사운드가 빠르게 재생될때
|
| 28871 |
HTML
id와 class의 차이점?
5
|
| 28870 | |
| 10881 |
MySQL
평가 표시 ★☆로 할 때
9
|
| 10872 | |
| 10870 | |
| 28868 | |
| 10868 |
JavaScript
3D 회전식 메뉴입니다. 드레그해서 붙혀서 사용해보세요
1
|
| 10866 | |
| 28862 |
HTML
Ajax로 만든 쇼핑몰입니다.
5
|
| 10864 |
기타
랜덤백그라운드
1
|
| 28861 |
HTML
마소 컬러 선택 대화상자
|
| 10863 |
기타
회원에게만 보여준다
|
| 28860 |
HTML
KOSDAQ소스
|
| 10862 |
JavaScript
ZDNet Korea레이어
|
| 28859 | |
| 28858 | |
| 10861 |
JavaScript
present[다음에서 발췌]
|
| 10859 | |
| 28856 |
HTML
클릭한 메뉴 고정하기
1
|
| 10857 |
JavaScript
클릭시 화면이 위로 올라가는 현상 막아주기
1
|
| 28854 | |
| 10856 |
기타
쿠키1년간체크
|
| 28853 |
HTML
자막파일(.smi) 싱크밀고 당기기
|
| 28852 |
JavaScript
일정시간동안 이미지 자동으로 변경하기
|
| 28851 |
HTML
이미지 파일 에러 처리
|
| 10855 |
JavaScript
이미지 미리 로딩시켜놓기
|
| 28850 |
HTML
웹로봇 배제 표준
|
| 10854 | |
| 28849 |
HTML
아이프레임하나만 새로고침하기
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기