I am trying to make a Javascript calculator in which the answer to the equation is set to a variable
<p>All of the "off the shelf" calculator code will only put the answer into a form input box.</p>

<pre><code>&lt;FORM NAME="Calc"&gt;
&lt;TABLE BORDER=4&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;INPUT TYPE="text"   NAME="Input" Size="16"&gt;
&lt;br&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;INPUT TYPE="button" NAME="one"   VALUE="  1  " OnClick="Calc.Input.value += '1'"&gt;
&lt;INPUT TYPE="button" NAME="two"   VALUE="  2  " OnCLick="Calc.Input.value += '2'"&gt;
&lt;INPUT TYPE="button" NAME="three" VALUE="  3  " OnClick="Calc.Input.value += '3'"&gt;
&lt;INPUT TYPE="button" NAME="plus"  VALUE="  +  " OnClick="Calc.Input.value += ' + '"&gt;
&lt;br&gt;
&lt;INPUT TYPE="button" NAME="four"  VALUE="  4  " OnClick="Calc.Input.value += '4'"&gt;
&lt;INPUT TYPE="button" NAME="five"  VALUE="  5  " OnCLick="Calc.Input.value += '5'"&gt;
&lt;INPUT TYPE="button" NAME="six"   VALUE="  6  " OnClick="Calc.Input.value += '6'"&gt;
&lt;INPUT TYPE="button" NAME="minus" VALUE="  -  " OnClick="Calc.Input.value += ' - '"&gt;
&lt;br&gt;
&lt;INPUT TYPE="button" NAME="seven" VALUE="  7  " OnClick="Calc.Input.value += '7'"&gt;
&lt;INPUT TYPE="button" NAME="eight" VALUE="  8  " OnCLick="Calc.Input.value += '8'"&gt;
&lt;INPUT TYPE="button" NAME="nine"  VALUE="  9  " OnClick="Calc.Input.value += '9'"&gt;
&lt;INPUT TYPE="button" NAME="times" VALUE="  x  " OnClick="Calc.Input.value += ' * '"&gt;
&lt;br&gt;
&lt;INPUT TYPE="button" NAME="clear" VALUE="  c  " OnClick="Calc.Input.value = ''"&gt;
&lt;INPUT TYPE="button" NAME="zero"  VALUE="  0  " OnClick="Calc.Input.value += '0'"&gt;
&lt;INPUT TYPE="button" NAME="DoIt"  VALUE="  =  " OnClick="Calc.Input.value =    eval(Calc.Input.value)"&gt;
&lt;INPUT TYPE="button" NAME="div"   VALUE="  /  " OnClick="Calc.Input.value += ' / '"&gt;
&lt;br&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TABLE&gt;
&lt;/FORM&gt;
</code></pre>

<p>I need the answer which is:  </p>

<pre><code>&lt;INPUT TYPE="button" NAME="DoIt"  VALUE="  =  " OnClick="Calc.Input.value =    eval(Calc.Input.value)"&gt;
</code></pre>

<p>to be set as a variable. 
thanks</p>
