Base Conversion

Smooth and sound base conversion between hex and dec (hex2dec and dec2hex)…


This will not work anymore as the is a commercial sh1t3 that does not allow that… I know, it’s for free, but I mean the unsolicited advertisements do bring money, don’t they? Whatever…

Source Code

JavaScript code:

function dec2hex(){
dec = document.getElementById('decsrc').value;
res = parseInt(dec).toString(16);
document.getElementById('hexres').value = res;

function hex2dec(){
hex = document.getElementById('hexsrc').value;
res = parseInt(hex, 16);
document.getElementById('decres').value = res;

HTML code:

DEC:<input type="text" id="decsrc" oninput="dec2hex();" />
HEX:<input type="text" id="hexres" />
HEX:<input type="text" id="hexsrc" oninput="hex2dec();" />
DEC:<input type="text" id="decres" />

This entry was posted in Mathematics and tagged , , , . Bookmark the permalink.