<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1430 | 18년 전 | 2975 | ||
| 1429 | 18년 전 | 2921 | ||
| 1428 | 18년 전 | 2815 | ||
| 1427 | 18년 전 | 2127 | ||
| 1426 |
|
18년 전 | 2308 | |
| 1425 |
|
18년 전 | 2863 | |
| 1424 |
|
18년 전 | 2957 | |
| 1423 |
frotone
|
18년 전 | 4116 | |
| 1422 | 18년 전 | 6109 | ||
| 1421 | 18년 전 | 2044 | ||
| 1420 | 18년 전 | 2177 | ||
| 1419 | 18년 전 | 1885 | ||
| 1418 | 18년 전 | 1645 | ||
| 1417 | 18년 전 | 2630 | ||
| 1416 | 18년 전 | 1686 | ||
| 1415 | 18년 전 | 1556 | ||
| 1414 | 18년 전 | 4732 | ||
| 1413 | 18년 전 | 1787 | ||
| 1412 | 18년 전 | 1832 | ||
| 1411 | 18년 전 | 1839 | ||
| 1410 | 18년 전 | 1964 | ||
| 1409 | 18년 전 | 3624 | ||
| 1408 | 18년 전 | 1647 | ||
| 1407 | 18년 전 | 1516 | ||
| 1406 | 18년 전 | 1348 | ||
| 1405 | 18년 전 | 1853 | ||
| 1404 | 18년 전 | 1898 | ||
| 1403 |
frotone
|
18년 전 | 3643 | |
| 1402 | 18년 전 | 1970 | ||
| 1401 | 18년 전 | 3105 | ||
| 1400 | 18년 전 | 4726 | ||
| 1399 | 18년 전 | 2857 | ||
| 1398 | 18년 전 | 8043 | ||
| 1397 | 18년 전 | 4051 | ||
| 1396 |
|
18년 전 | 2737 | |
| 1395 | 18년 전 | 1519 | ||
| 1394 | 18년 전 | 2615 | ||
| 1393 | 18년 전 | 5036 | ||
| 1392 | 18년 전 | 5215 | ||
| 1391 |
cncafe
|
18년 전 | 2086 | |
| 1390 |
mixdesign
|
18년 전 | 4348 | |
| 1389 | 18년 전 | 4088 | ||
| 1388 |
mixdesign
|
18년 전 | 4141 | |
| 1387 | 18년 전 | 2260 | ||
| 1386 | 18년 전 | 4182 | ||
| 1385 |
mixdesign
|
18년 전 | 2168 | |
| 1384 | 18년 전 | 3275 | ||
| 1383 | 18년 전 | 4907 | ||
| 1382 | 18년 전 | 1946 | ||
| 1381 |
오디세우스
|
18년 전 | 3400 | |
| 1380 |
mixdesign
|
18년 전 | 1635 | |
| 1379 | 18년 전 | 2732 | ||
| 1378 |
mixdesign
|
18년 전 | 1657 | |
| 1377 | 18년 전 | 2705 | ||
| 1376 |
|
18년 전 | 2546 | |
| 1375 |
|
18년 전 | 1548 | |
| 1374 |
|
18년 전 | 1487 | |
| 1373 |
|
18년 전 | 1732 | |
| 1372 | 18년 전 | 2235 | ||
| 1371 | 18년 전 | 2012 | ||
| 1370 | 18년 전 | 2375 | ||
| 1369 | 18년 전 | 4907 | ||
| 1368 |
mixdesign
|
18년 전 | 1813 | |
| 1367 | 18년 전 | 1252 | ||
| 1366 | 18년 전 | 1375 | ||
| 1365 | 18년 전 | 1329 | ||
| 1364 | 18년 전 | 1075 | ||
| 1363 | 18년 전 | 1072 | ||
| 1362 | 18년 전 | 1400 | ||
| 1361 | 18년 전 | 1357 | ||
| 1360 | 18년 전 | 2346 | ||
| 1359 | 18년 전 | 1222 | ||
| 1358 | 18년 전 | 1601 | ||
| 1357 | 18년 전 | 2086 | ||
| 1356 | 18년 전 | 1273 | ||
| 1355 | 18년 전 | 2822 | ||
| 1354 | 18년 전 | 1267 | ||
| 1353 | 18년 전 | 1645 | ||
| 1352 | 18년 전 | 1493 | ||
| 1351 | 18년 전 | 1447 | ||
| 1350 | 18년 전 | 1230 | ||
| 1349 | 18년 전 | 1075 | ||
| 1348 | 18년 전 | 1661 | ||
| 1347 | 18년 전 | 1098 | ||
| 1346 | 18년 전 | 3611 | ||
| 1345 | 18년 전 | 1706 | ||
| 1344 |
mixdesign
|
18년 전 | 1785 | |
| 1343 | 18년 전 | 1110 | ||
| 1342 | 18년 전 | 1847 | ||
| 1341 | 18년 전 | 1093 | ||
| 1340 | 18년 전 | 1163 | ||
| 1339 | 18년 전 | 1013 | ||
| 1338 | 18년 전 | 1001 | ||
| 1337 | 18년 전 | 1092 | ||
| 1336 |
|
18년 전 | 2571 | |
| 1335 | 18년 전 | 1541 | ||
| 1334 | 18년 전 | 1633 | ||
| 1333 | 18년 전 | 1201 | ||
| 1332 | 18년 전 | 1869 | ||
| 1331 | 18년 전 | 1513 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기