Decimal:
Binary:
Octal:
Hexadecimal:
©hscripts.com
function dconvert()
{
var dnum=parseInt(document.getElementById("deci").value);
var dno=new Number(dnum);
if(!isNaN(dno))
{
document.getElementById("bin").value=dno.toString(2);
document.getElementById("oct").value=dno.toString(8);
document.getElementById("hdeci").value=dno.toString(16);
}
}
function bconvert(bn)
{
var len=bn.length;
var tot=0;
var i,j;
for(i=0,j=len-1;ilen;i++,j--)
{
tot=tot+parseInt(bn.charAt(i))*Math.pow(2,j);
}
var dec=new Number(tot);
...