티스토리 뷰
10진수, 16진수, 2진수, 8진수 변환 하는 겁니다..
문자: ASCII / Unicode Char
10진수: Dec
16진수: Hex
2진수: Bin
8진수: Oct
메시지:
각 위치에 숫자를 넣으면 자동으로 변환됩니다..
소스는 이렇습니다..
<SPAN style="FONT-FAMILY: 'DotumChe'"> 문자: </SPAN><INPUT style="BACKGROUND-COLOR: #edf7fe; WIDTH: 30px; COLOR: black" id=input_2008013103_C onkeyup=f_2008013103_C() name=input_2008013103_C value=Z> <SPAN style="FONT-FAMILY: Arial, sans-serif; FONT-WEIGHT: bold">ASCII / Unicode Char</SPAN><br />
<SPAN style="FONT-FAMILY: 'DotumChe'">10진수: </SPAN><INPUT style="BACKGROUND-COLOR: #ddddff; WIDTH: 250px; COLOR: black" id=input_2008013103_10 onkeyup=f_2008013103_10(); name=input_2008013103_10 value=90> <INPUT style="WIDTH: 30px" id=count_2008013103_10_d name=count_2008013103_10_d readOnly value=2> <SPAN style="FONT-FAMILY: Arial, sans-serif; FONT-WEIGHT: bold">Dec</SPAN><br />
<SPAN style="FONT-FAMILY: 'DotumChe'">16진수: </SPAN><INPUT style="BACKGROUND-COLOR: #ffdddd; WIDTH: 250px; COLOR: black" id=input_2008013103_16 onkeyup=f_2008013103_16() name=input_2008013103_16 value=5A> <INPUT style="WIDTH: 30px" id=count_2008013103_16_d name=count_2008013103_16_d readOnly value=2> <SPAN style="FONT-FAMILY: Arial, sans-serif; FONT-WEIGHT: bold">Hex</SPAN><br />
<SPAN style="FONT-FAMILY: 'DotumChe'"> 2진수: </SPAN><INPUT style="BACKGROUND-COLOR: #fff0ba; WIDTH: 250px; COLOR: black" id=input_2008013103_2 onkeyup=f_2008013103_2() name=input_2008013103_2 value=1011010> <INPUT style="WIDTH: 30px" id=count_2008013103_2_d name=count_2008013103_2_d readOnly value=7> <SPAN style="FONT-FAMILY: Arial, sans-serif; FONT-WEIGHT: bold">Bin</SPAN><br />
<SPAN style="FONT-FAMILY: 'DotumChe'"> 8진수: </SPAN><INPUT style="BACKGROUND-COLOR: #d4f0e2; WIDTH: 250px; COLOR: black" id=input_2008013103_8 onkeyup=f_2008013103_8() name=input_2008013103_8 value=132> <INPUT style="WIDTH: 30px" id=count_2008013103_8_d name=count_2008013103_8_d readOnly value=3> <SPAN style="FONT-FAMILY: Arial, sans-serif; FONT-WEIGHT: bold">Oct</SPAN><br />
<SPAN style="FONT-FAMILY: 'DotumChe'">메시지: </SPAN><INPUT style="BACKGROUND-COLOR: white; WIDTH: 250px; COLOR: black" id=output_msg_2008013103 name=output_msg_2008013103 readOnly value="8비트 정수의 범위"><br />
function f_2008013103_2()
{
var v = document.getElementById('input_2008013103_2').value; v = v.replace(/,|\s/g,'');
var r10, r16; v = parseInt(v, 2);
r10 = v.toString(10);
if (r10 == 'NaN') r10 = '';
r16 = v.toString(16).toUpperCase();
if (r16 == 'NAN') r16 = '';
r8 = v.toString(8);
if (r8 == 'NaN') r8 = '';
document.getElementById('input_2008013103_10').value = r10;
document.getElementById('input_2008013103_16').value = r16;
document.getElementById('input_2008013103_8').value = r8;
if (v > 0xFFFF) document.getElementById('input_2008013103_C').value = '';
else document.getElementById('input_2008013103_C').value = String.fromCharCode(v);
msg_2008013103(v);
}
문자: ASCII / Unicode Char
10진수: Dec
16진수: Hex
2진수: Bin
8진수: Oct
메시지:
각 위치에 숫자를 넣으면 자동으로 변환됩니다..
소스는 이렇습니다..
<SPAN style="FONT-FAMILY: 'DotumChe'"> 문자: </SPAN><INPUT style="BACKGROUND-COLOR: #edf7fe; WIDTH: 30px; COLOR: black" id=input_2008013103_C onkeyup=f_2008013103_C() name=input_2008013103_C value=Z> <SPAN style="FONT-FAMILY: Arial, sans-serif; FONT-WEIGHT: bold">ASCII / Unicode Char</SPAN><br />
<SPAN style="FONT-FAMILY: 'DotumChe'">10진수: </SPAN><INPUT style="BACKGROUND-COLOR: #ddddff; WIDTH: 250px; COLOR: black" id=input_2008013103_10 onkeyup=f_2008013103_10(); name=input_2008013103_10 value=90> <INPUT style="WIDTH: 30px" id=count_2008013103_10_d name=count_2008013103_10_d readOnly value=2> <SPAN style="FONT-FAMILY: Arial, sans-serif; FONT-WEIGHT: bold">Dec</SPAN><br />
<SPAN style="FONT-FAMILY: 'DotumChe'">16진수: </SPAN><INPUT style="BACKGROUND-COLOR: #ffdddd; WIDTH: 250px; COLOR: black" id=input_2008013103_16 onkeyup=f_2008013103_16() name=input_2008013103_16 value=5A> <INPUT style="WIDTH: 30px" id=count_2008013103_16_d name=count_2008013103_16_d readOnly value=2> <SPAN style="FONT-FAMILY: Arial, sans-serif; FONT-WEIGHT: bold">Hex</SPAN><br />
<SPAN style="FONT-FAMILY: 'DotumChe'"> 2진수: </SPAN><INPUT style="BACKGROUND-COLOR: #fff0ba; WIDTH: 250px; COLOR: black" id=input_2008013103_2 onkeyup=f_2008013103_2() name=input_2008013103_2 value=1011010> <INPUT style="WIDTH: 30px" id=count_2008013103_2_d name=count_2008013103_2_d readOnly value=7> <SPAN style="FONT-FAMILY: Arial, sans-serif; FONT-WEIGHT: bold">Bin</SPAN><br />
<SPAN style="FONT-FAMILY: 'DotumChe'"> 8진수: </SPAN><INPUT style="BACKGROUND-COLOR: #d4f0e2; WIDTH: 250px; COLOR: black" id=input_2008013103_8 onkeyup=f_2008013103_8() name=input_2008013103_8 value=132> <INPUT style="WIDTH: 30px" id=count_2008013103_8_d name=count_2008013103_8_d readOnly value=3> <SPAN style="FONT-FAMILY: Arial, sans-serif; FONT-WEIGHT: bold">Oct</SPAN><br />
<SPAN style="FONT-FAMILY: 'DotumChe'">메시지: </SPAN><INPUT style="BACKGROUND-COLOR: white; WIDTH: 250px; COLOR: black" id=output_msg_2008013103 name=output_msg_2008013103 readOnly value="8비트 정수의 범위"><br />
<SCRIPT type=text/javascript>
function f_2008013103_10()
{
var v = document.getElementById('input_2008013103_10').value; v = v.replace(/,|\s/g,'');
var r16, r2, r8; v = parseInt(v, 10);
function f_2008013103_10()
{
var v = document.getElementById('input_2008013103_10').value; v = v.replace(/,|\s/g,'');
var r16, r2, r8; v = parseInt(v, 10);
r16 = v.toString(16).toUpperCase();
if (r16 == 'NAN') r16 = '';
if (r16 == 'NAN') r16 = '';
r2 = v.toString(2);
if (r2 == 'NaN') r2 = '';
if (r2 == 'NaN') r2 = '';
r8 = v.toString(8);
if (r8 == 'NaN') r8 = '';
document.getElementById('input_2008013103_16').value = r16;
document.getElementById('input_2008013103_2').value = r2;
document.getElementById('input_2008013103_8').value = r8;
if (r8 == 'NaN') r8 = '';
document.getElementById('input_2008013103_16').value = r16;
document.getElementById('input_2008013103_2').value = r2;
document.getElementById('input_2008013103_8').value = r8;
if (v > 0xFFFF) document.getElementById('input_2008013103_C').value = '';
else document.getElementById('input_2008013103_C').value = String.fromCharCode(v);
msg_2008013103(v);
}
else document.getElementById('input_2008013103_C').value = String.fromCharCode(v);
msg_2008013103(v);
}
function f_2008013103_16()
{
var v = document.getElementById('input_2008013103_16').value; v = v.replace(/,|\s/g,'');
var r10, r2, r8; v = parseInt(v, 16);
r10 = v.toString(10);
if (r10 == 'NaN') r10 = '';
r2 = v.toString(2);
if (r2 == 'NaN') r2 = '';
r8 = v.toString(8);
if (r8 == 'NaN') r8 = '';
document.getElementById('input_2008013103_10').value = r10;
document.getElementById('input_2008013103_2').value = r2;
document.getElementById('input_2008013103_8').value = r8;
if (v > 0xFFFF) document.getElementById('input_2008013103_C').value = '';
else document.getElementById('input_2008013103_C').value = String.fromCharCode(v);
msg_2008013103(v);
}
{
var v = document.getElementById('input_2008013103_16').value; v = v.replace(/,|\s/g,'');
var r10, r2, r8; v = parseInt(v, 16);
r10 = v.toString(10);
if (r10 == 'NaN') r10 = '';
r2 = v.toString(2);
if (r2 == 'NaN') r2 = '';
r8 = v.toString(8);
if (r8 == 'NaN') r8 = '';
document.getElementById('input_2008013103_10').value = r10;
document.getElementById('input_2008013103_2').value = r2;
document.getElementById('input_2008013103_8').value = r8;
if (v > 0xFFFF) document.getElementById('input_2008013103_C').value = '';
else document.getElementById('input_2008013103_C').value = String.fromCharCode(v);
msg_2008013103(v);
}
function f_2008013103_2()
{
var v = document.getElementById('input_2008013103_2').value; v = v.replace(/,|\s/g,'');
var r10, r16; v = parseInt(v, 2);
r10 = v.toString(10);
if (r10 == 'NaN') r10 = '';
r16 = v.toString(16).toUpperCase();
if (r16 == 'NAN') r16 = '';
r8 = v.toString(8);
if (r8 == 'NaN') r8 = '';
document.getElementById('input_2008013103_10').value = r10;
document.getElementById('input_2008013103_16').value = r16;
document.getElementById('input_2008013103_8').value = r8;
if (v > 0xFFFF) document.getElementById('input_2008013103_C').value = '';
else document.getElementById('input_2008013103_C').value = String.fromCharCode(v);
msg_2008013103(v);
}
function f_2008013103_8()
{
var v = document.getElementById('input_2008013103_8').value; v = v.replace(/,|\s/g,'');
var r10, r16, r2; v = parseInt(v, 8);
r10 = v.toString(10);
if (r10 == 'NaN') r10 = '';
r16 = v.toString(16).toUpperCase();
if (r16 == 'NAN') r16 = '';
r2 = v.toString(2);
if (r2 == 'NaN') r2 = '';
document.getElementById('input_2008013103_10').value = r10;
document.getElementById('input_2008013103_16').value = r16;
document.getElementById('input_2008013103_2').value = r2;
if (v > 0xFFFF) document.getElementById('input_2008013103_C').value = '';
else document.getElementById('input_2008013103_C').value = String.fromCharCode(v);
msg_2008013103(v);
}
{
var v = document.getElementById('input_2008013103_8').value; v = v.replace(/,|\s/g,'');
var r10, r16, r2; v = parseInt(v, 8);
r10 = v.toString(10);
if (r10 == 'NaN') r10 = '';
r16 = v.toString(16).toUpperCase();
if (r16 == 'NAN') r16 = '';
r2 = v.toString(2);
if (r2 == 'NaN') r2 = '';
document.getElementById('input_2008013103_10').value = r10;
document.getElementById('input_2008013103_16').value = r16;
document.getElementById('input_2008013103_2').value = r2;
if (v > 0xFFFF) document.getElementById('input_2008013103_C').value = '';
else document.getElementById('input_2008013103_C').value = String.fromCharCode(v);
msg_2008013103(v);
}
function f_2008013103_C()
{
var v = document.getElementById('input_2008013103_C').value;
var r10, r16, r2, r8; v = v.charCodeAt(0);
{
var v = document.getElementById('input_2008013103_C').value;
var r10, r16, r2, r8; v = v.charCodeAt(0);
r10 = v.toString(10);
if (r10 == 'NaN') r10 = '';
if (r10 == 'NaN') r10 = '';
r16 = v.toString(16).toUpperCase();
if (r16 == 'NAN')
if (r16 == 'NAN')
r16 = ''; r2 = v.toString(2);
if (r2 == 'NaN') r2 = '';
if (r2 == 'NaN') r2 = '';
r8 = v.toString(8);
if (r8 == 'NaN') r8 = '';
document.getElementById('input_2008013103_10').value = r10;
document.getElementById('input_2008013103_16').value = r16;
document.getElementById('input_2008013103_2').value = r2;
document.getElementById('input_2008013103_8').value = r8;
msg_2008013103(v);
}
if (r8 == 'NaN') r8 = '';
document.getElementById('input_2008013103_10').value = r10;
document.getElementById('input_2008013103_16').value = r16;
document.getElementById('input_2008013103_2').value = r2;
document.getElementById('input_2008013103_8').value = r8;
msg_2008013103(v);
}
function msg_2008013103(v)
{
var msg = '';
var myColor = 'black';
v = Math.abs(v);
if (v > 0xFFFFFFFF) {
msg = '32비트 범위 초과. 정밀도 손실 가능'; myColor = 'red';
} else if (v > 0xFFFF) {
msg = '32비트 정수의 범위';
} else if (v > 0xFF) {
msg = '16비트 정수의 범위';
} else {
msg = '8비트 정수의 범위';
}
document.getElementById('output_msg_2008013103').style.color = myColor; document.getElementById('output_msg_2008013103').value = msg;
digits_2008013103();
}
{
var msg = '';
var myColor = 'black';
v = Math.abs(v);
if (v > 0xFFFFFFFF) {
msg = '32비트 범위 초과. 정밀도 손실 가능'; myColor = 'red';
} else if (v > 0xFFFF) {
msg = '32비트 정수의 범위';
} else if (v > 0xFF) {
msg = '16비트 정수의 범위';
} else {
msg = '8비트 정수의 범위';
}
document.getElementById('output_msg_2008013103').style.color = myColor; document.getElementById('output_msg_2008013103').value = msg;
digits_2008013103();
}
function digits_2008013103()
{
var v; v = document.getElementById('input_2008013103_10').value; v = v.replace(/,|\s/g,''); document.getElementById('count_2008013103_10_d').value = v.length; v = document.getElementById('input_2008013103_16').value; v = v.replace(/,|\s/g,'');
document.getElementById('count_2008013103_16_d').value = v.length; v = document.getElementById('input_2008013103_2').value; v = v.replace(/,|\s/g,'');
document.getElementById('count_2008013103_2_d').value = v.length; v = document.getElementById('input_2008013103_8').value; v = v.replace(/,|\s/g,'');
document.getElementById('count_2008013103_8_d').value = v.length;
}
</SCRIPT>
{
var v; v = document.getElementById('input_2008013103_10').value; v = v.replace(/,|\s/g,''); document.getElementById('count_2008013103_10_d').value = v.length; v = document.getElementById('input_2008013103_16').value; v = v.replace(/,|\s/g,'');
document.getElementById('count_2008013103_16_d').value = v.length; v = document.getElementById('input_2008013103_2').value; v = v.replace(/,|\s/g,'');
document.getElementById('count_2008013103_2_d').value = v.length; v = document.getElementById('input_2008013103_8').value; v = v.replace(/,|\s/g,'');
document.getElementById('count_2008013103_8_d').value = v.length;
}
</SCRIPT>
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- Wii GAME
- CNN Student News
- 티스토리달력2011
- NDS
- 웃기는 사진
- 2011사진공모전
- 가을
- oracle
- 젤다의 전설
- 티스토리달력2010
- NDS GAME LIST
- 오라클
- NDSi
- Free Coupon
- 아이폰
- 겨울
- 야생의 숨결
- jsp
- 게시판
- C/C++
- DLC
- 3분 영어 위클리
- 스포어
- 군대이야기
- 동유럽
- 슈퍼마리오 RPG
- Project Diet
- Spore
- ndsl
- 동물의숲
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함