Script Categories

Calculators >>> Binary Converter.

Computers read and store the decimal numbers we see everyday (1, 5, 10, 100, etc.) as binary numbers, a number of just 1's and 0's. All that you do is enter the decimal number and the script will output the binary equivalent!

to base

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function toBin(form) {
base = parseInt(form.base.value);
num = parseInt(form.num.value);
form.amount.value = num.toString(base);
//  End -->
<form name=numform>
type=text name=num size=8> to base
<input type=text name=base size=8 value=2 onBlur="if ((this.value<1)||(this.value>36)){alert('The base must be between 2 and 36.');;this.focus();}">
<input type=button value=" = " onclick="toBin(this.form)">
<input type=text name=amount size=15>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).