Edit in JSFiddle

var num = 0;

function init() {
	num = 0;
	update(0);
}

function update(n) {
    while (n > 255) {
		n -= 256;
    }
    while (n < 0) {
		n += 256;
    }
	document.forms.F0.dec.value = n + "";
	document.forms.F0.bin.value = tobin(n);
	document.forms.F0.hex.value = decimalToHex(n);
	document.forms.F0.ascii.value = String.fromCharCode(n);
	num = n;
}

function decimalToHex(n) {
    return (n.toString(16).toUpperCase());
}

function tobin(n) {
    return parseInt(n,10).toString(2);
}
<blockquote>
<form name=F0 onsubmit="">
<p> <input type=text name=dec  
    size=6 onChange='update(parseInt(document.forms.F0.dec.value, 10))'/> Kokonaisluku
    </p>
    <p> <input type=text name=bin  
        size=16 onChange='update(parseInt(document.forms.F0.bin.value, 2))'/> Binääriluku
    </p>
    <p> <input type=text name=hex  
        size=6 onChange='update(parseInt(document.forms.F0.hex.value, 16))'/> Heksaluku
    </p>
    <p> <input type=text name=ascii  
        size=6 onChange='update(document.forms.F0.ascii.value)'/> ASCII -merkki
    </p>
        <p><input type=button value="Lisää 1" onClick='update(parseInt(num)+1)'/> &nbsp; &nbsp; &nbsp; 
        <input type=button value="Vähennä 1" onClick='update(parseInt(num)-1)'/> &nbsp; &nbsp; &nbsp; 

            <input type=button value="Nollaa" onClick='init()'/>
    </p>
</form>

</blockquote>