<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>
게시글 목록
| 번호 | 제목 |
|---|---|
| 10853 |
JavaScript
속도를 위해 데이터를 접속자 메모리에
|
| 10852 | |
| 10850 | |
| 28848 | |
| 10849 |
JavaScript
백그라운드에음악걸기
|
| 28847 |
HTML
배경에 그림스타일지정
|
| 10846 |
기타
메신저형식의광고
2
|
| 28846 |
HTML
많이 쓰이는 자바스크립트
|
| 10845 | |
| 28845 |
HTML
마우스로 이미지크기 변경하기
|
| 10844 |
JavaScript
도메인 주소에 자동으로 www 붙이기 (php)
|
| 28844 |
HTML
다음부동산매물스크립트1
|
| 28843 |
HTML
다음부동산매물스크립트
|
| 10843 |
JavaScript
다각형이미지슬라이드쇼(익스네츠)
|
| 28842 |
HTML
날짜 형식 입력 받은 값 확인하기
|
| 10842 | |
| 28841 |
HTML
그림클릭시 레이어 띄우기
|
| 10841 |
MySQL
그림을 디비에 저장하는 방법
|
| 28840 |
HTML
그림 앨범 스크립트
|
| 28839 |
HTML
간단한 팝업오브젝트 예제
|
| 10840 |
JavaScript
가운데 정렬된 홈페이지에서 따라다니는 레이어
|
| 10839 | |
| 24791 | |
| 24789 | |
| 10836 |
기타
외부 링크 막기
2
|
| 28838 | |
| 24788 | |
| 24787 | |
| 24786 |
계약서
농지임대차계약서
|
| 28837 | |
| 28834 |
HTML
URL옆에 뜨는 숏컷아이콘만들기.
2
|
| 10835 |
JavaScript
클릭시 펼쳐지는 메뉴
|
| 10834 |
정규표현식
수수료계산
|
| 28833 |
HTML
기본적인 페이징
|
| 28829 |
HTML
만 19세 확인하기
3
|
| 10833 |
JavaScript
IE에서 쓰는 CSS filter 사이트 소개
|
| 10831 | |
| 10830 | |
| 10829 |
JavaScript
iconv 함수 사용시 일부 글자가 변환되지 않는경우
|
| 28828 |
HTML
금액에 점찍고 한글 표시하기
현재글
|
| 10828 | |
| 10827 |
MySQL
mysql link 추가로 만들기
|
| 10823 | |
| 10822 |
기타
[펌] SAMBA 설정
|
| 10821 |
JavaScript
1-1000 까지 누락된 숫자 구하기
|
| 10820 | |
| 28822 |
HTML
간단하게 만들어본 프레임워크
5
|
| 10814 | |
| 10812 |
Flash
vr기능-도와주셈
1
|
| 10811 | |
| 10810 |
JavaScript
mod_cband 간단 정리
|
| 10808 |
Flash
간단한 플래시 보완패치입니다.
1
|
| 10804 |
JavaScript
cs..cs2 버젼...윈도우즈 탐색기프리뷰 패치(psd,ai)...
3
|
| 10797 | |
| 28821 |
HTML
IeTagConvertor
|
| 10796 | |
| 10795 |
JavaScript
ncftp 서브 디렉토리 포함 모두 전송
|
| 10794 |
JavaScript
테이블 각 row 마우스오버시 색깔바꾸기
|
| 10792 | |
| 10789 |
MySQL
apache - mod_ssl 설치하기
2
|
| 10785 | |
| 10781 | |
| 10780 |
정규표현식
자바스크립트 이메일 체크 함수
|
| 28820 |
HTML
PHP에서 홈페이지 주소 검사
|
| 10776 |
PHP
문자셋(인코딩 바꾸는 팁
3
|
| 10769 |
JavaScript
당장써먹어야 할 팁) 앞으로 gif는 물러가고 png시대가 될거 같네요
6
|
| 10766 |
JavaScript
full-down메뉴[펌]
2
|
| 10765 |
JavaScript
플래쉬 무비 전체 화면으로 뜨게 하는 fscommand
|
| 10758 |
JavaScript
코딩시 테이블을 줄입시다.
6
|
| 28818 | |
| 10754 |
JavaScript
모든 폰트 설정 한번에 바꾸기(식별자 *의 사용법)
3
|
| 10753 | |
| 10750 | |
| 28817 |
HTML
자바스크립트에서 변수 없애기
|
| 10749 | |
| 10748 | |
| 10747 | |
| 10746 |
JavaScript
[소개]윈도우 미디어 플레이어 - 컨트롤 버튼
|
| 10740 |
JavaScript
iframe사용시 높이 자동 조정
5
|
| 10738 |
Flash
플래시 무비에 레이어 올리기
1
|
| 10735 |
JavaScript
도움말 띄우기 - 관리자 페이지에 있는 것을 추림
2
|
| 10734 | |
| 28812 | |
| 10730 | |
| 10726 | |
| 10725 |
기타
자바스크립트 기초문서
|
| 28811 | |
| 10724 |
JavaScript
숫자를 한글로 변환하기
|
| 10723 |
JavaScript
디렉터리 파일 찾기 순서 DirectoryIndex
|
| 10722 | |
| 10721 | |
| 10717 | |
| 10716 |
기타
Apache 보안 팁
|
| 10715 |
JavaScript
문서루트 위치 DocumentRoot
|
| 10713 |
Linux
lilo.conf
1
|
| 10712 | |
| 10711 | |
| 10710 |
JavaScript
웹 서버가 기다리는 포트(Port)
|
| 10709 |
JavaScript
logrotate.conf의 설정및 옵션에 대한 설명
|
| 10708 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기