<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1630 | 17년 전 | 2365 | ||
| 1629 | 17년 전 | 2836 | ||
| 1628 |
인스웨이브시스템즈
|
17년 전 | 4614 | |
| 1627 | 17년 전 | 2673 | ||
| 1626 |
silence
|
17년 전 | 1869 | |
| 1625 |
|
17년 전 | 3314 | |
| 1624 | 17년 전 | 3134 | ||
| 1623 | 17년 전 | 3855 | ||
| 1622 | 17년 전 | 2168 | ||
| 1621 | 17년 전 | 2342 | ||
| 1620 | 17년 전 | 9998 | ||
| 1619 | 17년 전 | 3497 | ||
| 1618 | 18년 전 | 3298 | ||
| 1617 | 18년 전 | 3186 | ||
| 1616 |
|
18년 전 | 2798 | |
| 1615 | 18년 전 | 4161 | ||
| 1614 |
에스카르고
|
18년 전 | 5503 | |
| 1613 | 18년 전 | 3736 | ||
| 1612 | 18년 전 | 3181 | ||
| 1611 | 18년 전 | 3604 | ||
| 1610 |
DHenny
|
18년 전 | 2256 | |
| 1609 | 18년 전 | 2685 | ||
| 1608 |
|
18년 전 | 3919 | |
| 1607 | 18년 전 | 2844 | ||
| 1606 |
|
18년 전 | 4354 | |
| 1605 | 18년 전 | 2073 | ||
| 1604 |
|
18년 전 | 2511 | |
| 1603 |
|
18년 전 | 2408 | |
| 1602 |
|
18년 전 | 3762 | |
| 1601 |
|
18년 전 | 3828 | |
| 1600 | 18년 전 | 2569 | ||
| 1599 | 18년 전 | 2639 | ||
| 1598 | 18년 전 | 2970 | ||
| 1597 |
|
18년 전 | 2801 | |
| 1596 |
|
18년 전 | 2008 | |
| 1595 |
|
18년 전 | 2181 | |
| 1594 | 18년 전 | 4830 | ||
| 1593 | 18년 전 | 4176 | ||
| 1592 | 18년 전 | 2800 | ||
| 1591 | 18년 전 | 2358 | ||
| 1590 | 18년 전 | 2862 | ||
| 1589 | 18년 전 | 2338 | ||
| 1588 |
|
18년 전 | 3500 | |
| 1587 | 18년 전 | 2171 | ||
| 1586 | 18년 전 | 1967 | ||
| 1585 | 18년 전 | 1823 | ||
| 1584 | 18년 전 | 1640 | ||
| 1583 | 18년 전 | 3236 | ||
| 1582 | 18년 전 | 4559 | ||
| 1581 | 18년 전 | 4838 | ||
| 1580 |
|
18년 전 | 2128 | |
| 1579 | 18년 전 | 3579 | ||
| 1578 | 18년 전 | 3303 | ||
| 1577 | 18년 전 | 4590 | ||
| 1576 | 18년 전 | 3235 | ||
| 1575 | 18년 전 | 4233 | ||
| 1574 |
개발전문가
|
18년 전 | 3921 | |
| 1573 |
mixdesign
|
18년 전 | 3609 | |
| 1572 |
mixdesign
|
18년 전 | 3009 | |
| 1571 |
mixdesign
|
18년 전 | 2905 | |
| 1570 | 18년 전 | 3482 | ||
| 1569 |
mixdesign
|
18년 전 | 2133 | |
| 1568 |
mixdesign
|
18년 전 | 2089 | |
| 1567 | 18년 전 | 5492 | ||
| 1566 |
mixdesign
|
18년 전 | 2668 | |
| 1565 |
mixdesign
|
18년 전 | 2408 | |
| 1564 | 18년 전 | 2717 | ||
| 1563 | 18년 전 | 2063 | ||
| 1562 | 18년 전 | 3047 | ||
| 1561 | 18년 전 | 10011 | ||
| 1560 |
행복속네잎크로버
|
18년 전 | 1909 | |
| 1559 | 18년 전 | 2825 | ||
| 1558 |
1111111
|
18년 전 | 2863 | |
| 1557 |
1111111
|
18년 전 | 2118 | |
| 1556 |
1111111
|
18년 전 | 2956 | |
| 1555 |
1111111
|
18년 전 | 3956 | |
| 1554 |
1111111
|
18년 전 | 2916 | |
| 1553 |
1111111
|
18년 전 | 2293 | |
| 1552 |
1111111
|
18년 전 | 6011 | |
| 1551 |
1111111
|
18년 전 | 3637 | |
| 1550 |
1111111
|
18년 전 | 6311 | |
| 1549 |
1111111
|
18년 전 | 2410 | |
| 1548 |
1111111
|
18년 전 | 2336 | |
| 1547 |
1111111
|
18년 전 | 2358 | |
| 1546 |
1111111
|
18년 전 | 3307 | |
| 1545 |
1111111
|
18년 전 | 3165 | |
| 1544 |
1111111
|
18년 전 | 1952 | |
| 1543 |
1111111
|
18년 전 | 3686 | |
| 1542 |
1111111
|
18년 전 | 1602 | |
| 1541 |
1111111
|
18년 전 | 1346 | |
| 1540 |
1111111
|
18년 전 | 1368 | |
| 1539 |
1111111
|
18년 전 | 1524 | |
| 1538 |
1111111
|
18년 전 | 1614 | |
| 1537 |
스카이부아
|
18년 전 | 3403 | |
| 1536 |
1111111
|
18년 전 | 2244 | |
| 1535 |
1111111
|
18년 전 | 1694 | |
| 1534 |
1111111
|
18년 전 | 2093 | |
| 1533 |
1111111
|
18년 전 | 4593 | |
| 1532 |
1111111
|
18년 전 | 2320 | |
| 1531 |
1111111
|
18년 전 | 2964 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기