<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7730 | 10년 전 | 1284 | ||
| 7729 | 10년 전 | 1098 | ||
| 7728 |
잘살아보자
|
10년 전 | 564 | |
| 7727 |
잘살아보자
|
10년 전 | 462 | |
| 7726 |
잘살아보자
|
10년 전 | 796 | |
| 7725 |
잘살아보자
|
10년 전 | 528 | |
| 7724 |
잘살아보자
|
10년 전 | 433 | |
| 7723 |
잘살아보자
|
10년 전 | 502 | |
| 7722 |
잘살아보자
|
10년 전 | 441 | |
| 7721 |
잘살아보자
|
10년 전 | 479 | |
| 7720 |
잘살아보자
|
10년 전 | 417 | |
| 7719 |
비긴어게인
|
10년 전 | 662 | |
| 7718 |
|
10년 전 | 2503 | |
| 7717 |
잘살아보자
|
10년 전 | 633 | |
| 7716 |
잘살아보자
|
10년 전 | 372 | |
| 7715 |
잘살아보자
|
10년 전 | 409 | |
| 7714 |
잘살아보자
|
10년 전 | 447 | |
| 7713 | 10년 전 | 1752 | ||
| 7712 | 10년 전 | 1684 | ||
| 7711 | 10년 전 | 1070 | ||
| 7710 | 10년 전 | 1354 | ||
| 7709 | 10년 전 | 1487 | ||
| 7708 | 10년 전 | 1439 | ||
| 7707 | 10년 전 | 833 | ||
| 7706 |
별지기천사
|
10년 전 | 549 | |
| 7705 | 10년 전 | 1050 | ||
| 7704 |
ICONdesignstudio
|
10년 전 | 593 | |
| 7703 | 10년 전 | 561 | ||
| 7702 |
|
10년 전 | 687 | |
| 7701 | 10년 전 | 1387 | ||
| 7700 | 10년 전 | 1083 | ||
| 7699 | 10년 전 | 562 | ||
| 7698 | 10년 전 | 1114 | ||
| 7697 | 10년 전 | 5120 | ||
| 7696 | 10년 전 | 617 | ||
| 7695 | 10년 전 | 1655 | ||
| 7694 | 10년 전 | 1020 | ||
| 7693 | 10년 전 | 1519 | ||
| 7692 | 10년 전 | 1255 | ||
| 7691 | 10년 전 | 784 | ||
| 7690 | 10년 전 | 1368 | ||
| 7689 | 10년 전 | 986 | ||
| 7688 | 10년 전 | 576 | ||
| 7687 |
파랑새1597
|
10년 전 | 559 | |
| 7686 | 10년 전 | 804 | ||
| 7685 | 10년 전 | 1328 | ||
| 7684 | 10년 전 | 774 | ||
| 7683 | 10년 전 | 1023 | ||
| 7682 | 10년 전 | 934 | ||
| 7681 | 10년 전 | 625 | ||
| 7680 | 10년 전 | 970 | ||
| 7679 | 10년 전 | 464 | ||
| 7678 | 10년 전 | 698 | ||
| 7677 | 10년 전 | 598 | ||
| 7676 |
|
10년 전 | 921 | |
| 7675 |
|
10년 전 | 1124 | |
| 7674 | 10년 전 | 1030 | ||
| 7673 | 10년 전 | 731 | ||
| 7672 | 10년 전 | 1063 | ||
| 7671 | 10년 전 | 851 | ||
| 7670 | 10년 전 | 614 | ||
| 7669 |
mashmellow
|
10년 전 | 1206 | |
| 7668 | 10년 전 | 688 | ||
| 7667 | 10년 전 | 966 | ||
| 7666 |
senseme
|
10년 전 | 627 | |
| 7665 | 10년 전 | 482 | ||
| 7664 | 10년 전 | 1873 | ||
| 7663 |
mixx애교
|
10년 전 | 959 | |
| 7662 | 10년 전 | 1008 | ||
| 7661 |
hkhkah
|
10년 전 | 763 | |
| 7660 | 10년 전 | 1040 | ||
| 7659 |
커네드커네드
|
10년 전 | 910 | |
| 7658 |
바람돌이팡
|
10년 전 | 640 | |
| 7657 | 10년 전 | 1143 | ||
| 7656 | 10년 전 | 1544 | ||
| 7655 | 10년 전 | 956 | ||
| 7654 |
개발짜증나
|
10년 전 | 842 | |
| 7653 |
네이비칼라
|
10년 전 | 872 | |
| 7652 |
밥먹고합시다
|
10년 전 | 792 | |
| 7651 |
플라이SINJI
|
10년 전 | 1491 | |
| 7650 |
개발짜증나
|
10년 전 | 1387 | |
| 7649 | 10년 전 | 432 | ||
| 7648 |
이미영ㅇㅇ
|
10년 전 | 845 | |
| 7647 | 10년 전 | 413 | ||
| 7646 | 10년 전 | 777 | ||
| 7645 | 10년 전 | 2280 | ||
| 7644 | 10년 전 | 796 | ||
| 7643 |
|
10년 전 | 2845 | |
| 7642 | 10년 전 | 1493 | ||
| 7641 | 10년 전 | 1111 | ||
| 7640 |
개발짜증나
|
10년 전 | 458 | |
| 7639 |
|
10년 전 | 797 | |
| 7638 |
개발짜증나
|
10년 전 | 1101 | |
| 7637 | 10년 전 | 1521 | ||
| 7636 | 10년 전 | 2884 | ||
| 7635 | 10년 전 | 1667 | ||
| 7634 | 10년 전 | 1834 | ||
| 7633 | 10년 전 | 2304 | ||
| 7632 | 10년 전 | 3905 | ||
| 7631 |
|
10년 전 | 1510 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기