<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 830 |
|
19년 전 | 2175 | |
| 829 |
|
19년 전 | 1903 | |
| 828 |
|
19년 전 | 1789 | |
| 827 |
|
19년 전 | 1646 | |
| 826 |
|
19년 전 | 1839 | |
| 825 |
|
19년 전 | 1882 | |
| 824 |
|
19년 전 | 1940 | |
| 823 |
|
19년 전 | 2685 | |
| 822 |
|
19년 전 | 5310 | |
| 821 |
|
19년 전 | 1717 | |
| 820 |
|
19년 전 | 1562 | |
| 819 |
|
19년 전 | 1428 | |
| 818 |
|
19년 전 | 1587 | |
| 817 |
|
19년 전 | 1517 | |
| 816 |
|
19년 전 | 1434 | |
| 815 |
|
19년 전 | 1446 | |
| 814 |
|
19년 전 | 1373 | |
| 813 |
|
19년 전 | 1435 | |
| 812 | 19년 전 | 2799 | ||
| 811 |
pearly
|
19년 전 | 3817 | |
| 810 |
pearly
|
19년 전 | 5200 | |
| 809 |
|
19년 전 | 1365 | |
| 808 |
pearly
|
19년 전 | 4530 | |
| 807 | 19년 전 | 2974 | ||
| 806 |
|
19년 전 | 1487 | |
| 805 |
|
19년 전 | 2683 | |
| 804 |
|
19년 전 | 3608 | |
| 803 |
|
19년 전 | 1778 | |
| 802 |
|
19년 전 | 3782 | |
| 801 |
|
19년 전 | 1874 | |
| 800 | 19년 전 | 3766 | ||
| 799 | 19년 전 | 3418 | ||
| 798 | 19년 전 | 4199 | ||
| 797 | 19년 전 | 4048 | ||
| 796 |
|
19년 전 | 1880 | |
| 795 |
|
19년 전 | 1839 | |
| 794 | 19년 전 | 4266 | ||
| 793 | 19년 전 | 2666 | ||
| 792 | 19년 전 | 2535 | ||
| 791 | 19년 전 | 2387 | ||
| 790 | 19년 전 | 1966 | ||
| 789 | 19년 전 | 2560 | ||
| 788 | 19년 전 | 2192 | ||
| 787 | 19년 전 | 1841 | ||
| 786 | 19년 전 | 1969 | ||
| 785 | 19년 전 | 1436 | ||
| 784 |
|
19년 전 | 1685 | |
| 783 | 19년 전 | 2826 | ||
| 782 |
|
19년 전 | 1943 | |
| 781 | 19년 전 | 3223 | ||
| 780 | 19년 전 | 3132 | ||
| 779 |
|
19년 전 | 2240 | |
| 778 |
|
19년 전 | 1786 | |
| 777 | 19년 전 | 2829 | ||
| 776 | 19년 전 | 2896 | ||
| 775 | 19년 전 | 4006 | ||
| 774 |
|
19년 전 | 1968 | |
| 773 | 19년 전 | 2617 | ||
| 772 | 19년 전 | 2330 | ||
| 771 | 19년 전 | 3459 | ||
| 770 |
|
19년 전 | 1417 | |
| 769 | 19년 전 | 1483 | ||
| 768 | 19년 전 | 1761 | ||
| 767 | 19년 전 | 2202 | ||
| 766 | 19년 전 | 1830 | ||
| 765 | 19년 전 | 1693 | ||
| 764 |
|
19년 전 | 2099 | |
| 763 |
|
19년 전 | 2202 | |
| 762 |
|
19년 전 | 4960 | |
| 761 | 19년 전 | 2322 | ||
| 760 |
|
19년 전 | 3191 | |
| 759 | 19년 전 | 2638 | ||
| 758 |
|
19년 전 | 2401 | |
| 757 | 19년 전 | 4696 | ||
| 756 | 19년 전 | 2558 | ||
| 755 |
|
19년 전 | 2404 | |
| 754 |
|
19년 전 | 1938 | |
| 753 |
|
19년 전 | 1720 | |
| 752 |
pearly
|
19년 전 | 3354 | |
| 751 | 19년 전 | 2318 | ||
| 750 |
|
19년 전 | 6152 | |
| 749 | 19년 전 | 2016 | ||
| 748 |
|
19년 전 | 1892 | |
| 747 |
|
19년 전 | 2699 | |
| 746 |
|
19년 전 | 1802 | |
| 745 | 19년 전 | 2275 | ||
| 744 | 19년 전 | 2103 | ||
| 743 |
|
19년 전 | 3553 | |
| 742 | 19년 전 | 2568 | ||
| 741 | 19년 전 | 2737 | ||
| 740 |
|
19년 전 | 4361 | |
| 739 | 19년 전 | 3538 | ||
| 738 |
|
19년 전 | 2298 | |
| 737 | 19년 전 | 4285 | ||
| 736 | 19년 전 | 3259 | ||
| 735 |
홀로남은자
|
19년 전 | 4125 | |
| 734 |
홀로남은자
|
19년 전 | 2004 | |
| 733 |
홀로남은자
|
19년 전 | 2219 | |
| 732 | 19년 전 | 2138 | ||
| 731 | 19년 전 | 3344 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기