<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1530 |
1111111
|
18년 전 | 1952 | |
| 1529 |
행복속네잎크로버
|
18년 전 | 3447 | |
| 1528 |
행복속네잎크로버
|
18년 전 | 1828 | |
| 1527 |
1111111
|
18년 전 | 7639 | |
| 1526 |
1111111
|
18년 전 | 3284 | |
| 1525 |
행복속네잎크로버
|
18년 전 | 1268 | |
| 1524 |
행복속네잎크로버
|
18년 전 | 2300 | |
| 1523 |
행복속네잎크로버
|
18년 전 | 3502 | |
| 1522 |
행복속네잎크로버
|
18년 전 | 2358 | |
| 1521 |
행복속네잎크로버
|
18년 전 | 2124 | |
| 1520 |
행복속네잎크로버
|
18년 전 | 2756 | |
| 1519 |
행복속네잎크로버
|
18년 전 | 3716 | |
| 1518 |
행복속네잎크로버
|
18년 전 | 3479 | |
| 1517 |
행복속네잎크로버
|
18년 전 | 2559 | |
| 1516 |
행복속네잎크로버
|
18년 전 | 1910 | |
| 1515 |
행복속네잎크로버
|
18년 전 | 1928 | |
| 1514 |
행복속네잎크로버
|
18년 전 | 2503 | |
| 1513 |
행복속네잎크로버
|
18년 전 | 1981 | |
| 1512 | 18년 전 | 2868 | ||
| 1511 | 18년 전 | 1659 | ||
| 1510 | 18년 전 | 2205 | ||
| 1509 | 18년 전 | 1679 | ||
| 1508 | 18년 전 | 2137 | ||
| 1507 | 18년 전 | 2356 | ||
| 1506 | 18년 전 | 2291 | ||
| 1505 | 18년 전 | 2245 | ||
| 1504 | 18년 전 | 2172 | ||
| 1503 | 18년 전 | 3482 | ||
| 1502 | 18년 전 | 1661 | ||
| 1501 | 18년 전 | 3439 | ||
| 1500 | 18년 전 | 2018 | ||
| 1499 | 18년 전 | 5288 | ||
| 1498 | 18년 전 | 2149 | ||
| 1497 |
hsp1980
|
18년 전 | 2329 | |
| 1496 |
hsp1980
|
18년 전 | 1723 | |
| 1495 |
hsp1980
|
18년 전 | 2131 | |
| 1494 |
hsp1980
|
18년 전 | 3644 | |
| 1493 | 18년 전 | 1497 | ||
| 1492 | 18년 전 | 1737 | ||
| 1491 | 18년 전 | 4315 | ||
| 1490 | 18년 전 | 3702 | ||
| 1489 | 18년 전 | 3262 | ||
| 1488 | 18년 전 | 3363 | ||
| 1487 |
mixdesign
|
18년 전 | 3863 | |
| 1486 |
mixdesign
|
18년 전 | 4322 | |
| 1485 | 18년 전 | 4246 | ||
| 1484 | 18년 전 | 2700 | ||
| 1483 |
hsp1980
|
18년 전 | 2309 | |
| 1482 |
hsp1980
|
18년 전 | 3245 | |
| 1481 |
hsp1980
|
18년 전 | 3160 | |
| 1480 |
hsp1980
|
18년 전 | 3317 | |
| 1479 | 18년 전 | 3254 | ||
| 1478 |
|
18년 전 | 4921 | |
| 1477 |
|
18년 전 | 5205 | |
| 1476 | 18년 전 | 3402 | ||
| 1475 |
mixdesign
|
18년 전 | 2715 | |
| 1474 |
mixdesign
|
18년 전 | 2939 | |
| 1473 |
mixdesign
|
18년 전 | 2266 | |
| 1472 |
mixdesign
|
18년 전 | 2084 | |
| 1471 |
mixdesign
|
18년 전 | 2033 | |
| 1470 |
|
18년 전 | 3071 | |
| 1469 |
mixdesign
|
18년 전 | 2351 | |
| 1468 |
mixdesign
|
18년 전 | 2369 | |
| 1467 |
mixdesign
|
18년 전 | 2049 | |
| 1466 |
mixdesign
|
18년 전 | 2418 | |
| 1465 |
mixdesign
|
18년 전 | 3151 | |
| 1464 | 18년 전 | 4080 | ||
| 1463 | 18년 전 | 3368 | ||
| 1462 |
|
18년 전 | 1997 | |
| 1461 |
|
18년 전 | 1939 | |
| 1460 | 18년 전 | 2855 | ||
| 1459 | 18년 전 | 1648 | ||
| 1458 |
|
18년 전 | 1999 | |
| 1457 |
mixdesign
|
18년 전 | 2290 | |
| 1456 |
mixdesign
|
18년 전 | 2153 | |
| 1455 | 18년 전 | 2261 | ||
| 1454 | 18년 전 | 4029 | ||
| 1453 | 18년 전 | 1773 | ||
| 1452 | 18년 전 | 4385 | ||
| 1451 | 18년 전 | 2916 | ||
| 1450 | 18년 전 | 2215 | ||
| 1449 | 18년 전 | 3267 | ||
| 1448 | 18년 전 | 2894 | ||
| 1447 | 18년 전 | 2823 | ||
| 1446 | 18년 전 | 5625 | ||
| 1445 | 18년 전 | 2290 | ||
| 1444 | 18년 전 | 3407 | ||
| 1443 |
|
18년 전 | 3321 | |
| 1442 | 18년 전 | 3706 | ||
| 1441 | 18년 전 | 3260 | ||
| 1440 | 18년 전 | 2435 | ||
| 1439 | 18년 전 | 2083 | ||
| 1438 | 18년 전 | 2537 | ||
| 1437 | 18년 전 | 6105 | ||
| 1436 | 18년 전 | 2731 | ||
| 1435 | 18년 전 | 4542 | ||
| 1434 | 18년 전 | 2037 | ||
| 1433 | 18년 전 | 10024 | ||
| 1432 | 18년 전 | 2473 | ||
| 1431 |
Psychedelico
|
18년 전 | 1538 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기