<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1730 | 17년 전 | 1179 | ||
| 1729 | 17년 전 | 1595 | ||
| 1728 | 17년 전 | 1668 | ||
| 1727 | 17년 전 | 1810 | ||
| 1726 | 17년 전 | 2946 | ||
| 1725 | 17년 전 | 2082 | ||
| 1724 |
|
17년 전 | 1766 | |
| 1723 |
끝없는사랑
|
17년 전 | 2099 | |
| 1722 |
끝없는사랑
|
17년 전 | 1806 | |
| 1721 | 17년 전 | 3340 | ||
| 1720 | 17년 전 | 1523 | ||
| 1719 | 17년 전 | 1645 | ||
| 1718 |
사랑합니다
|
17년 전 | 1362 | |
| 1717 | 17년 전 | 2178 | ||
| 1716 | 17년 전 | 3132 | ||
| 1715 |
|
17년 전 | 2270 | |
| 1714 |
|
17년 전 | 1726 | |
| 1713 | 17년 전 | 2974 | ||
| 1712 | 17년 전 | 4419 | ||
| 1711 | 17년 전 | 1735 | ||
| 1710 | 17년 전 | 3235 | ||
| 1709 |
jeans
|
17년 전 | 1562 | |
| 1708 |
|
17년 전 | 3472 | |
| 1707 | 17년 전 | 5835 | ||
| 1706 |
|
17년 전 | 1413 | |
| 1705 |
|
17년 전 | 2151 | |
| 1704 | 17년 전 | 1785 | ||
| 1703 |
심심맨닷컴
|
17년 전 | 1525 | |
| 1702 | 17년 전 | 2412 | ||
| 1701 |
|
17년 전 | 2616 | |
| 1700 | 17년 전 | 1592 | ||
| 1699 | 17년 전 | 2678 | ||
| 1698 |
RedRiverFisher
|
17년 전 | 3163 | |
| 1697 |
심심맨닷컴
|
17년 전 | 1517 | |
| 1696 |
eclub
|
17년 전 | 1932 | |
| 1695 | 17년 전 | 3839 | ||
| 1694 |
깜장고무신
|
17년 전 | 4474 | |
| 1693 |
stuartkim
|
17년 전 | 1868 | |
| 1692 |
stuartkim
|
17년 전 | 1721 | |
| 1691 |
|
17년 전 | 2660 | |
| 1690 | 17년 전 | 1841 | ||
| 1689 | 17년 전 | 3927 | ||
| 1688 | 17년 전 | 1634 | ||
| 1687 | 16년 전 | 1918 | ||
| 1686 |
|
17년 전 | 2253 | |
| 1685 | 17년 전 | 2103 | ||
| 1684 |
|
17년 전 | 3563 | |
| 1683 |
leeLook
|
17년 전 | 1581 | |
| 1682 | 17년 전 | 2651 | ||
| 1681 | 17년 전 | 1630 | ||
| 1680 | 17년 전 | 1900 | ||
| 1679 | 17년 전 | 7417 | ||
| 1678 | 17년 전 | 1993 | ||
| 1677 | 17년 전 | 4084 | ||
| 1676 | 17년 전 | 2414 | ||
| 1675 | 17년 전 | 2423 | ||
| 1674 | 17년 전 | 2143 | ||
| 1673 | 17년 전 | 2195 | ||
| 1672 | 17년 전 | 2615 | ||
| 1671 | 17년 전 | 3209 | ||
| 1670 | 17년 전 | 5319 | ||
| 1669 |
플래시007
|
17년 전 | 2770 | |
| 1668 |
|
17년 전 | 2691 | |
| 1667 | 17년 전 | 2543 | ||
| 1666 |
|
17년 전 | 1789 | |
| 1665 | 17년 전 | 2196 | ||
| 1664 | 17년 전 | 5300 | ||
| 1663 |
|
17년 전 | 3013 | |
| 1662 |
|
17년 전 | 2577 | |
| 1661 |
|
17년 전 | 3249 | |
| 1660 |
|
17년 전 | 2464 | |
| 1659 |
|
17년 전 | 2825 | |
| 1658 | 17년 전 | 5865 | ||
| 1657 | 17년 전 | 2623 | ||
| 1656 |
Piece
|
17년 전 | 2017 | |
| 1655 |
|
17년 전 | 2645 | |
| 1654 | 17년 전 | 1474 | ||
| 1653 | 17년 전 | 9792 | ||
| 1652 | 17년 전 | 4447 | ||
| 1651 | 17년 전 | 3278 | ||
| 1650 | 17년 전 | 1805 | ||
| 1649 | 17년 전 | 3598 | ||
| 1648 | 17년 전 | 2278 | ||
| 1647 | 17년 전 | 3725 | ||
| 1646 | 17년 전 | 5173 | ||
| 1645 | 17년 전 | 3824 | ||
| 1644 | 17년 전 | 2668 | ||
| 1643 | 17년 전 | 2932 | ||
| 1642 | 17년 전 | 2440 | ||
| 1641 | 17년 전 | 2777 | ||
| 1640 |
porgy
|
17년 전 | 1895 | |
| 1639 | 17년 전 | 3433 | ||
| 1638 |
컴퓨터기술자
|
17년 전 | 2134 | |
| 1637 |
|
17년 전 | 2256 | |
| 1636 | 17년 전 | 2072 | ||
| 1635 | 17년 전 | 3042 | ||
| 1634 |
귀여운현호
|
17년 전 | 1990 | |
| 1633 |
태양의서쪽
|
17년 전 | 2661 | |
| 1632 | 17년 전 | 3863 | ||
| 1631 | 17년 전 | 4562 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기