<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 2030 | 17년 전 | 2802 | ||
| 2029 | 17년 전 | 1605 | ||
| 2028 | 17년 전 | 1353 | ||
| 2027 | 17년 전 | 1614 | ||
| 2026 |
진정한승리
|
17년 전 | 2523 | |
| 2025 | 17년 전 | 1744 | ||
| 2024 | 17년 전 | 2021 | ||
| 2023 | 17년 전 | 1316 | ||
| 2022 |
SE7EN
|
17년 전 | 1052 | |
| 2021 | 17년 전 | 1129 | ||
| 2020 | 17년 전 | 2932 | ||
| 2019 | 17년 전 | 2476 | ||
| 2018 | 17년 전 | 2052 | ||
| 2017 | 17년 전 | 2053 | ||
| 2016 | 17년 전 | 1806 | ||
| 2015 | 17년 전 | 2255 | ||
| 2014 | 17년 전 | 2021 | ||
| 2013 | 17년 전 | 1988 | ||
| 2012 | 17년 전 | 1880 | ||
| 2011 | 17년 전 | 1218 | ||
| 2010 | 17년 전 | 1826 | ||
| 2009 | 17년 전 | 2231 | ||
| 2008 | 17년 전 | 2310 | ||
| 2007 | 17년 전 | 1643 | ||
| 2006 |
Arone
|
17년 전 | 1516 | |
| 2005 |
|
17년 전 | 1364 | |
| 2004 | 17년 전 | 2589 | ||
| 2003 |
suerte
|
17년 전 | 2685 | |
| 2002 |
suerte
|
17년 전 | 2084 | |
| 2001 |
suerte
|
17년 전 | 2426 | |
| 2000 |
|
17년 전 | 2730 | |
| 1999 |
|
17년 전 | 1334 | |
| 1998 |
|
17년 전 | 1201 | |
| 1997 | 17년 전 | 6337 | ||
| 1996 | 17년 전 | 1191 | ||
| 1995 | 17년 전 | 1635 | ||
| 1994 | 17년 전 | 1785 | ||
| 1993 | 17년 전 | 1111 | ||
| 1992 | 17년 전 | 1202 | ||
| 1991 | 17년 전 | 1898 | ||
| 1990 |
sdjsu
|
17년 전 | 1526 | |
| 1989 | 17년 전 | 3625 | ||
| 1988 |
smilesol
|
17년 전 | 1216 | |
| 1987 |
|
17년 전 | 1916 | |
| 1986 | 17년 전 | 1192 | ||
| 1985 | 17년 전 | 1396 | ||
| 1984 | 17년 전 | 2370 | ||
| 1983 | 17년 전 | 2028 | ||
| 1982 | 17년 전 | 1044 | ||
| 1981 | 17년 전 | 1051 | ||
| 1980 | 17년 전 | 1110 | ||
| 1979 |
오렌지76
|
17년 전 | 6056 | |
| 1978 |
오렌지76
|
17년 전 | 5855 | |
| 1977 | 17년 전 | 2043 | ||
| 1976 |
없어씨바라
|
17년 전 | 1035 | |
| 1975 | 17년 전 | 1122 | ||
| 1974 | 17년 전 | 2088 | ||
| 1973 | 17년 전 | 1522 | ||
| 1972 | 17년 전 | 1161 | ||
| 1971 |
smilesol
|
17년 전 | 1202 | |
| 1970 | 17년 전 | 1150 | ||
| 1969 |
smilesol
|
17년 전 | 1072 | |
| 1968 |
소행성블루
|
17년 전 | 3976 | |
| 1967 |
소행성블루
|
17년 전 | 2179 | |
| 1966 | 17년 전 | 1654 | ||
| 1965 |
소행성블루
|
17년 전 | 2782 | |
| 1964 |
고양Ol아빠
|
17년 전 | 1484 | |
| 1963 | 17년 전 | 1172 | ||
| 1962 | 17년 전 | 1191 | ||
| 1961 |
choijinhee
|
17년 전 | 1252 | |
| 1960 | 17년 전 | 1137 | ||
| 1959 | 17년 전 | 1257 | ||
| 1958 |
하이웹솔루션
|
17년 전 | 2413 | |
| 1957 | 17년 전 | 4196 | ||
| 1956 | 17년 전 | 1200 | ||
| 1955 | 17년 전 | 3956 | ||
| 1954 | 17년 전 | 4113 | ||
| 1953 | 17년 전 | 1239 | ||
| 1952 | 17년 전 | 2188 | ||
| 1951 | 17년 전 | 1624 | ||
| 1950 | 17년 전 | 3222 | ||
| 1949 | 17년 전 | 1368 | ||
| 1948 | 17년 전 | 3616 | ||
| 1947 | 17년 전 | 3408 | ||
| 1946 | 17년 전 | 2578 | ||
| 1945 | 17년 전 | 2945 | ||
| 1944 | 17년 전 | 2634 | ||
| 1943 | 17년 전 | 1953 | ||
| 1942 | 17년 전 | 3319 | ||
| 1941 | 17년 전 | 2630 | ||
| 1940 | 17년 전 | 3529 | ||
| 1939 |
|
17년 전 | 1167 | |
| 1938 | 17년 전 | 2254 | ||
| 1937 | 17년 전 | 1328 | ||
| 1936 |
smilesol
|
17년 전 | 1200 | |
| 1935 |
AHEEZII
|
17년 전 | 1065 | |
| 1934 |
smilesol
|
17년 전 | 1045 | |
| 1933 | 17년 전 | 1421 | ||
| 1932 | 17년 전 | 2863 | ||
| 1931 | 17년 전 | 3255 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기