<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>