<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1930 | 17년 전 | 2996 | ||
| 1929 | 17년 전 | 1873 | ||
| 1928 | 17년 전 | 3987 | ||
| 1927 | 17년 전 | 1401 | ||
| 1926 |
지엔소프트
|
17년 전 | 1119 | |
| 1925 |
보드타는찌니
|
17년 전 | 1229 | |
| 1924 |
choijinhee
|
17년 전 | 1114 | |
| 1923 | 17년 전 | 1372 | ||
| 1922 | 17년 전 | 1737 | ||
| 1921 | 17년 전 | 2335 | ||
| 1920 | 17년 전 | 2412 | ||
| 1919 | 17년 전 | 1415 | ||
| 1918 | 17년 전 | 1163 | ||
| 1917 | 17년 전 | 2430 | ||
| 1916 | 17년 전 | 2857 | ||
| 1915 |
|
17년 전 | 3224 | |
| 1914 | 17년 전 | 3166 | ||
| 1913 | 17년 전 | 2324 | ||
| 1912 | 17년 전 | 3746 | ||
| 1911 | 17년 전 | 3175 | ||
| 1910 | 17년 전 | 5495 | ||
| 1909 | 17년 전 | 2648 | ||
| 1908 | 17년 전 | 1850 | ||
| 1907 | 17년 전 | 1932 | ||
| 1906 | 17년 전 | 1770 | ||
| 1905 | 17년 전 | 1698 | ||
| 1904 | 17년 전 | 2762 | ||
| 1903 | 17년 전 | 1880 | ||
| 1902 | 17년 전 | 1571 | ||
| 1901 | 17년 전 | 2062 | ||
| 1900 |
stuartkim
|
17년 전 | 1127 | |
| 1899 | 17년 전 | 1658 | ||
| 1898 | 17년 전 | 2872 | ||
| 1897 | 17년 전 | 2111 | ||
| 1896 | 17년 전 | 1803 | ||
| 1895 | 17년 전 | 2022 | ||
| 1894 | 17년 전 | 1310 | ||
| 1893 | 17년 전 | 1704 | ||
| 1892 | 17년 전 | 1206 | ||
| 1891 | 17년 전 | 1767 | ||
| 1890 | 17년 전 | 1795 | ||
| 1889 | 17년 전 | 1034 | ||
| 1888 | 17년 전 | 3134 | ||
| 1887 | 17년 전 | 4309 | ||
| 1886 | 17년 전 | 2453 | ||
| 1885 | 17년 전 | 7456 | ||
| 1884 | 17년 전 | 3824 | ||
| 1883 | 17년 전 | 4154 | ||
| 1882 | 17년 전 | 2415 | ||
| 1881 | 17년 전 | 2878 | ||
| 1880 | 17년 전 | 3626 | ||
| 1879 | 17년 전 | 3995 | ||
| 1878 | 17년 전 | 3158 | ||
| 1877 | 17년 전 | 3141 | ||
| 1876 | 17년 전 | 3289 | ||
| 1875 | 17년 전 | 2456 | ||
| 1874 | 17년 전 | 2052 | ||
| 1873 | 17년 전 | 3099 | ||
| 1872 | 17년 전 | 3248 | ||
| 1871 | 17년 전 | 4604 | ||
| 1870 | 17년 전 | 1577 | ||
| 1869 | 17년 전 | 2609 | ||
| 1868 | 17년 전 | 2684 | ||
| 1867 | 17년 전 | 1895 | ||
| 1866 | 17년 전 | 2213 | ||
| 1865 | 17년 전 | 1825 | ||
| 1864 | 17년 전 | 2364 | ||
| 1863 | 17년 전 | 3766 | ||
| 1862 | 17년 전 | 3882 | ||
| 1861 | 17년 전 | 2077 | ||
| 1860 | 17년 전 | 1352 | ||
| 1859 | 17년 전 | 1490 | ||
| 1858 |
|
17년 전 | 1635 | |
| 1857 | 17년 전 | 1620 | ||
| 1856 |
보드타는찌니
|
17년 전 | 1381 | |
| 1855 | 17년 전 | 1524 | ||
| 1854 |
|
17년 전 | 1342 | |
| 1853 | 17년 전 | 1834 | ||
| 1852 | 17년 전 | 2740 | ||
| 1851 | 17년 전 | 1836 | ||
| 1850 |
|
17년 전 | 1385 | |
| 1849 |
|
17년 전 | 1672 | |
| 1848 |
|
17년 전 | 2318 | |
| 1847 | 17년 전 | 1939 | ||
| 1846 |
은사시나무
|
17년 전 | 1254 | |
| 1845 |
갈색야생마
|
17년 전 | 5895 | |
| 1844 |
갈색야생마
|
17년 전 | 3277 | |
| 1843 |
갈색야생마
|
17년 전 | 3172 | |
| 1842 |
갈색야생마
|
17년 전 | 2589 | |
| 1841 |
갈색야생마
|
17년 전 | 2769 | |
| 1840 |
갈색야생마
|
17년 전 | 2718 | |
| 1839 |
갈색야생마
|
17년 전 | 3222 | |
| 1838 |
갈색야생마
|
17년 전 | 2350 | |
| 1837 |
갈색야생마
|
17년 전 | 2468 | |
| 1836 |
갈색야생마
|
17년 전 | 2530 | |
| 1835 |
갈색야생마
|
17년 전 | 2519 | |
| 1834 |
갈색야생마
|
17년 전 | 2656 | |
| 1833 |
갈색야생마
|
17년 전 | 3180 | |
| 1832 |
갈색야생마
|
17년 전 | 2696 | |
| 1831 |
갈색야생마
|
17년 전 | 1424 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기