<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 730 |
|
19년 전 | 2724 | |
| 729 |
그레이스웹
|
19년 전 | 3516 | |
| 728 |
|
19년 전 | 2691 | |
| 727 |
|
19년 전 | 2529 | |
| 726 |
|
19년 전 | 2345 | |
| 725 |
|
19년 전 | 2250 | |
| 724 |
|
19년 전 | 2135 | |
| 723 |
|
19년 전 | 4256 | |
| 722 |
|
19년 전 | 2674 | |
| 721 |
|
19년 전 | 2166 | |
| 720 |
|
19년 전 | 2263 | |
| 719 |
|
19년 전 | 2852 | |
| 718 |
|
19년 전 | 1963 | |
| 717 |
|
19년 전 | 3197 | |
| 716 |
|
19년 전 | 2754 | |
| 715 |
|
19년 전 | 2272 | |
| 714 |
|
19년 전 | 1823 | |
| 713 |
|
19년 전 | 2241 | |
| 712 |
|
19년 전 | 2013 | |
| 711 |
|
19년 전 | 1908 | |
| 710 |
|
19년 전 | 2470 | |
| 709 |
|
19년 전 | 2333 | |
| 708 |
|
19년 전 | 3893 | |
| 707 |
|
19년 전 | 3742 | |
| 706 |
|
19년 전 | 2239 | |
| 705 |
|
19년 전 | 3306 | |
| 704 |
|
19년 전 | 1973 | |
| 703 |
|
19년 전 | 2385 | |
| 702 |
|
19년 전 | 2280 | |
| 701 |
홀로남은자
|
19년 전 | 2348 | |
| 700 |
홀로남은자
|
19년 전 | 2182 | |
| 699 | 19년 전 | 2817 | ||
| 698 |
|
19년 전 | 2841 | |
| 697 |
|
19년 전 | 3173 | |
| 696 |
|
19년 전 | 3046 | |
| 695 |
|
19년 전 | 2709 | |
| 694 |
|
19년 전 | 2943 | |
| 693 |
|
19년 전 | 3191 | |
| 692 |
|
19년 전 | 2880 | |
| 691 |
|
19년 전 | 2629 | |
| 690 | 19년 전 | 2929 | ||
| 689 | 19년 전 | 4514 | ||
| 688 | 19년 전 | 2440 | ||
| 687 | 19년 전 | 2452 | ||
| 686 | 19년 전 | 3479 | ||
| 685 | 19년 전 | 3169 | ||
| 684 | 19년 전 | 2825 | ||
| 683 | 19년 전 | 2060 | ||
| 682 | 19년 전 | 1776 | ||
| 681 | 19년 전 | 2876 | ||
| 680 | 19년 전 | 1723 | ||
| 679 | 19년 전 | 2312 | ||
| 678 | 19년 전 | 3962 | ||
| 677 | 19년 전 | 3739 | ||
| 676 | 19년 전 | 3469 | ||
| 675 | 19년 전 | 3410 | ||
| 674 |
|
19년 전 | 1567 | |
| 673 |
|
19년 전 | 1939 | |
| 672 |
|
19년 전 | 1864 | |
| 671 | 19년 전 | 2526 | ||
| 670 | 19년 전 | 4631 | ||
| 669 |
|
19년 전 | 2766 | |
| 668 |
|
19년 전 | 1925 | |
| 667 |
|
19년 전 | 1937 | |
| 666 |
|
19년 전 | 1839 | |
| 665 |
|
19년 전 | 2576 | |
| 664 |
|
19년 전 | 8178 | |
| 663 |
|
19년 전 | 2732 | |
| 662 |
|
19년 전 | 2790 | |
| 661 |
|
19년 전 | 3045 | |
| 660 |
|
19년 전 | 2212 | |
| 659 |
|
19년 전 | 2225 | |
| 658 |
|
19년 전 | 2172 | |
| 657 |
|
19년 전 | 2084 | |
| 656 |
|
19년 전 | 2270 | |
| 655 |
|
19년 전 | 2534 | |
| 654 |
|
19년 전 | 3080 | |
| 653 | 19년 전 | 2331 | ||
| 652 | 19년 전 | 1917 | ||
| 651 |
|
19년 전 | 2842 | |
| 650 | 19년 전 | 5008 | ||
| 649 | 19년 전 | 3505 | ||
| 648 | 19년 전 | 3460 | ||
| 647 | 19년 전 | 2974 | ||
| 646 | 19년 전 | 2403 | ||
| 645 | 19년 전 | 1499 | ||
| 644 | 19년 전 | 3140 | ||
| 643 | 19년 전 | 2021 | ||
| 642 |
|
19년 전 | 5390 | |
| 641 | 19년 전 | 2436 | ||
| 640 | 19년 전 | 3435 | ||
| 639 | 19년 전 | 2863 | ||
| 638 | 19년 전 | 1766 | ||
| 637 | 19년 전 | 3880 | ||
| 636 | 19년 전 | 2427 | ||
| 635 | 19년 전 | 2318 | ||
| 634 |
|
19년 전 | 3025 | |
| 633 |
|
19년 전 | 3303 | |
| 632 | 19년 전 | 2505 | ||
| 631 | 19년 전 | 2267 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기