<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1030 | 18년 전 | 1777 | ||
| 1029 | 18년 전 | 2213 | ||
| 1028 | 18년 전 | 2626 | ||
| 1027 | 18년 전 | 1786 | ||
| 1026 | 18년 전 | 1518 | ||
| 1025 | 18년 전 | 1532 | ||
| 1024 | 18년 전 | 1459 | ||
| 1023 | 18년 전 | 3219 | ||
| 1022 | 18년 전 | 2910 | ||
| 1021 | 18년 전 | 1667 | ||
| 1020 | 18년 전 | 3406 | ||
| 1019 | 18년 전 | 1834 | ||
| 1018 | 18년 전 | 1484 | ||
| 1017 | 18년 전 | 1948 | ||
| 1016 | 18년 전 | 2092 | ||
| 1015 | 18년 전 | 1628 | ||
| 1014 | 18년 전 | 2339 | ||
| 1013 | 18년 전 | 1995 | ||
| 1012 | 18년 전 | 1607 | ||
| 1011 | 18년 전 | 1780 | ||
| 1010 | 18년 전 | 2036 | ||
| 1009 | 18년 전 | 1792 | ||
| 1008 | 18년 전 | 1594 | ||
| 1007 | 18년 전 | 1652 | ||
| 1006 | 18년 전 | 3123 | ||
| 1005 | 18년 전 | 1990 | ||
| 1004 | 18년 전 | 1861 | ||
| 1003 | 18년 전 | 4364 | ||
| 1002 | 18년 전 | 4991 | ||
| 1001 | 18년 전 | 3155 | ||
| 1000 | 18년 전 | 2901 | ||
| 999 | 18년 전 | 3495 | ||
| 998 | 18년 전 | 2036 | ||
| 997 | 18년 전 | 2388 | ||
| 996 | 18년 전 | 2686 | ||
| 995 | 18년 전 | 2750 | ||
| 994 | 18년 전 | 2346 | ||
| 993 | 18년 전 | 1608 | ||
| 992 | 18년 전 | 3374 | ||
| 991 | 18년 전 | 1974 | ||
| 990 | 18년 전 | 2378 | ||
| 989 | 18년 전 | 2449 | ||
| 988 | 18년 전 | 2875 | ||
| 987 | 18년 전 | 5210 | ||
| 986 |
|
18년 전 | 2486 | |
| 985 |
|
18년 전 | 3335 | |
| 984 | 18년 전 | 4273 | ||
| 983 |
느낌좋은날
|
18년 전 | 2498 | |
| 982 | 18년 전 | 2461 | ||
| 981 | 18년 전 | 4034 | ||
| 980 | 19년 전 | 2746 | ||
| 979 |
Sinpre
|
19년 전 | 2986 | |
| 978 | 19년 전 | 2201 | ||
| 977 | 19년 전 | 2215 | ||
| 976 | 19년 전 | 1990 | ||
| 975 | 19년 전 | 3271 | ||
| 974 | 19년 전 | 2103 | ||
| 973 |
|
19년 전 | 2779 | |
| 972 |
|
19년 전 | 1738 | |
| 971 | 19년 전 | 5308 | ||
| 970 | 19년 전 | 3563 | ||
| 969 | 19년 전 | 4315 | ||
| 968 | 19년 전 | 3057 | ||
| 967 | 19년 전 | 2521 | ||
| 966 | 19년 전 | 3916 | ||
| 965 | 19년 전 | 2644 | ||
| 964 | 19년 전 | 2987 | ||
| 963 | 19년 전 | 2955 | ||
| 962 | 19년 전 | 4173 | ||
| 961 | 19년 전 | 3122 | ||
| 960 | 19년 전 | 3017 | ||
| 959 | 19년 전 | 3666 | ||
| 958 | 19년 전 | 2973 | ||
| 957 | 19년 전 | 2190 | ||
| 956 | 19년 전 | 2220 | ||
| 955 | 19년 전 | 2162 | ||
| 954 | 19년 전 | 2764 | ||
| 953 | 19년 전 | 2472 | ||
| 952 | 19년 전 | 3340 | ||
| 951 | 19년 전 | 3197 | ||
| 950 | 19년 전 | 1823 | ||
| 949 | 19년 전 | 2738 | ||
| 948 | 19년 전 | 7823 | ||
| 947 |
|
19년 전 | 2494 | |
| 946 |
DeepnBlue
|
19년 전 | 3098 | |
| 945 |
pearly
|
19년 전 | 2857 | |
| 944 | 19년 전 | 3015 | ||
| 943 |
|
19년 전 | 2213 | |
| 942 | 19년 전 | 2448 | ||
| 941 |
|
19년 전 | 4068 | |
| 940 | 19년 전 | 2227 | ||
| 939 |
|
19년 전 | 4216 | |
| 938 |
|
19년 전 | 2377 | |
| 937 | 19년 전 | 2071 | ||
| 936 |
|
19년 전 | 2320 | |
| 935 | 19년 전 | 1864 | ||
| 934 |
|
19년 전 | 2397 | |
| 933 | 19년 전 | 2189 | ||
| 932 |
|
19년 전 | 3061 | |
| 931 | 19년 전 | 1850 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기