Assigning a value to a letter to use in an equation in JavaScript
<p>I am writing an application in JavaScript that handles a series of simple equations. It's mainly additions involving numbers from 0 to 10, but the letter X needs to be usable as well: counting as the number 10. This is part of what I have:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function updateround() {
        document.form.round01.value = (document.form.arrow01.value -0) + (document.form.arrow02.value -0) + (document.form.arrow03.value -0);
    }
&lt;/script&gt;
&lt;body&gt;
    &lt;center&gt;
            &lt;form name="form"&gt;
                &lt;table&gt;
                    &lt;tr&gt;
                        &lt;td&gt;&lt;input name="arrow01" style="width: 30px;" onChange="updateround()"&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;input name="arrow02" style="width: 30px;" onChange="updateround()"&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;input name="arrow03" style="width: 30px;" onChange="updateround()"&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;input name="round01" style="width: 30px;"&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                &lt;/table&gt;
            &lt;/form&gt;
    &lt;/center&gt;
&lt;/body&gt;
</code></pre>

<p>If you run this you get 4 input fields: if you write numbers in the first three and click somewhere else they add up in the fourth field.</p>

<p>What I am looking for is how to make it so that if you enter the letter X into one of the first three fields the application uses it as 10 in the equation. For example, if you enter X, 9 and 9 in the first three fields you get 28 in the fourth, if you enter X, X and 6 you get 26 and so on. Also, where do I put this code in the application?</p>

<p>May thanks in advance.</p>
