<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1830 |
갈색야생마
|
17년 전 | 2845 | |
| 1829 |
갈색야생마
|
17년 전 | 1590 | |
| 1828 |
갈색야생마
|
17년 전 | 1342 | |
| 1827 |
갈색야생마
|
17년 전 | 2013 | |
| 1826 |
갈색야생마
|
17년 전 | 1458 | |
| 1825 |
갈색야생마
|
17년 전 | 1401 | |
| 1824 |
갈색야생마
|
17년 전 | 1341 | |
| 1823 |
갈색야생마
|
17년 전 | 1552 | |
| 1822 |
갈색야생마
|
17년 전 | 2046 | |
| 1821 |
갈색야생마
|
17년 전 | 1426 | |
| 1820 |
갈색야생마
|
17년 전 | 1402 | |
| 1819 |
갈색야생마
|
17년 전 | 1206 | |
| 1818 |
갈색야생마
|
17년 전 | 1438 | |
| 1817 |
갈색야생마
|
17년 전 | 1167 | |
| 1816 |
갈색야생마
|
17년 전 | 1298 | |
| 1815 |
갈색야생마
|
17년 전 | 1555 | |
| 1814 |
갈색야생마
|
17년 전 | 1390 | |
| 1813 |
갈색야생마
|
17년 전 | 1290 | |
| 1812 |
갈색야생마
|
17년 전 | 1261 | |
| 1811 |
갈색야생마
|
17년 전 | 1378 | |
| 1810 |
갈색야생마
|
17년 전 | 1151 | |
| 1809 |
갈색야생마
|
17년 전 | 1202 | |
| 1808 |
갈색야생마
|
17년 전 | 1235 | |
| 1807 |
갈색야생마
|
17년 전 | 1310 | |
| 1806 |
갈색야생마
|
17년 전 | 1331 | |
| 1805 |
갈색야생마
|
17년 전 | 1336 | |
| 1804 |
갈색야생마
|
17년 전 | 1301 | |
| 1803 |
갈색야생마
|
17년 전 | 1622 | |
| 1802 | 17년 전 | 2955 | ||
| 1801 | 17년 전 | 3353 | ||
| 1800 | 17년 전 | 1446 | ||
| 1799 | 17년 전 | 1543 | ||
| 1798 | 17년 전 | 1358 | ||
| 1797 | 17년 전 | 2114 | ||
| 1796 | 17년 전 | 3028 | ||
| 1795 | 17년 전 | 1373 | ||
| 1794 | 17년 전 | 1357 | ||
| 1793 |
갈색야생마
|
17년 전 | 1354 | |
| 1792 |
갈색야생마
|
17년 전 | 1221 | |
| 1791 |
갈색야생마
|
17년 전 | 1411 | |
| 1790 |
갈색야생마
|
17년 전 | 1469 | |
| 1789 |
갈색야생마
|
17년 전 | 1277 | |
| 1788 |
갈색야생마
|
17년 전 | 2562 | |
| 1787 |
갈색야생마
|
17년 전 | 1309 | |
| 1786 |
갈색야생마
|
17년 전 | 1585 | |
| 1785 |
갈색야생마
|
17년 전 | 1457 | |
| 1784 |
갈색야생마
|
17년 전 | 1764 | |
| 1783 |
갈색야생마
|
17년 전 | 1785 | |
| 1782 | 17년 전 | 1802 | ||
| 1781 | 17년 전 | 1848 | ||
| 1780 | 17년 전 | 1510 | ||
| 1779 | 17년 전 | 1596 | ||
| 1778 |
갈색야생마
|
17년 전 | 1512 | |
| 1777 |
갈색야생마
|
17년 전 | 1856 | |
| 1776 |
갈색야생마
|
17년 전 | 1758 | |
| 1775 |
갈색야생마
|
17년 전 | 1549 | |
| 1774 |
갈색야생마
|
17년 전 | 1734 | |
| 1773 |
갈색야생마
|
17년 전 | 1402 | |
| 1772 |
갈색야생마
|
17년 전 | 1631 | |
| 1771 |
갈색야생마
|
17년 전 | 1950 | |
| 1770 |
갈색야생마
|
17년 전 | 2784 | |
| 1769 | 17년 전 | 1992 | ||
| 1768 | 17년 전 | 1400 | ||
| 1767 | 17년 전 | 1943 | ||
| 1766 | 17년 전 | 2401 | ||
| 1765 | 17년 전 | 1560 | ||
| 1764 | 17년 전 | 2316 | ||
| 1763 |
sini117
|
17년 전 | 1750 | |
| 1762 |
sini117
|
17년 전 | 1453 | |
| 1761 |
nooree
|
17년 전 | 1312 | |
| 1760 | 17년 전 | 1992 | ||
| 1759 | 17년 전 | 2881 | ||
| 1758 | 17년 전 | 2498 | ||
| 1757 | 17년 전 | 1519 | ||
| 1756 | 17년 전 | 2867 | ||
| 1755 | 17년 전 | 2403 | ||
| 1754 | 17년 전 | 2750 | ||
| 1753 | 17년 전 | 2764 | ||
| 1752 | 17년 전 | 2548 | ||
| 1751 | 17년 전 | 2365 | ||
| 1750 | 17년 전 | 1717 | ||
| 1749 | 17년 전 | 2454 | ||
| 1748 | 17년 전 | 3954 | ||
| 1747 |
|
17년 전 | 1822 | |
| 1746 | 17년 전 | 3905 | ||
| 1745 | 17년 전 | 1836 | ||
| 1744 | 17년 전 | 1728 | ||
| 1743 | 17년 전 | 2068 | ||
| 1742 | 17년 전 | 2472 | ||
| 1741 | 17년 전 | 1419 | ||
| 1740 | 17년 전 | 1770 | ||
| 1739 | 17년 전 | 2332 | ||
| 1738 | 17년 전 | 1805 | ||
| 1737 | 17년 전 | 1762 | ||
| 1736 | 17년 전 | 1539 | ||
| 1735 | 17년 전 | 1381 | ||
| 1734 | 17년 전 | 1338 | ||
| 1733 | 17년 전 | 1156 | ||
| 1732 | 17년 전 | 1141 | ||
| 1731 | 17년 전 | 1172 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기