I have a form where a user enters a decimal number and then from the dropdown menu he chooses if he wants to convert it either to binary, octal or hexadecimal by clicking on a c
you can directly convert your values to binary and octal and hexadecimal like this
function Answer() {
if (document.getElementbyId ('selectid').value=="binary") {
this.value = this.value.toString(2);
}
else if (document.getElementbyId ('selectid').value=="octal") {
this.value = this.value.toString(8);
}
else if (document.getElementbyId ('selectid').value=="hexadecimal") {
this.value = this.value.toString(16);
}
}