javascript out update onchange
<p>I'm trying to get the javascript below to automatically update the input field (centimeters) below when a user select there height and inches. It should auto calculate the centimeters, and its not working.</p>

<pre><code>&lt;script type=​"text/​javascript"&gt;​
updateHeights:function(type){
    if(type=='english'){
        var feet=parseInt($F('feet'));
        var inches=parseInt($F('inches'));
        var cm=((feet*12+inches)*2.54).round();
        $('centimeters').value=(feet?cm:'');
        } 
        else 
        {
        var cm=parseInt($F('centimeters'))||183;
    if(cm&gt;241||cm&lt;91)cm=183;
        var inches_total=(cm*0.3937).round();
        var feet=(inches_total/12).floor();
        var inches=inches_total%12;
        $('feet').value=feet;
        $('inches').value=inches;
        $('centimeters').value=cm;
    }
}
&lt;/script&gt;

&lt;label&gt;Height:&lt;/label&gt;
&lt;select id="feet" name="add[feet]" onchange="Profile.updateHeights('english')"&gt;
    &lt;option value=""&gt;—&lt;/option&gt;
    &lt;option value="7"&gt;7&lt;/option&gt;
    &lt;option value="6"&gt;6&lt;/option&gt;
    &lt;option value="5"&gt;5&lt;/option&gt;
    &lt;option value="4"&gt;4&lt;/option&gt;
    &lt;option value="3"&gt;3&lt;/option&gt;
&lt;/select&gt;ft.&amp;nbsp;&amp;nbsp;
&lt;select id="inches" name="add[inch]" onchange="Profile.updateHeights('english')"&gt;
    &lt;option value="0"&gt;0&lt;/option&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="2"&gt;2&lt;/option&gt;
    &lt;option value="3"&gt;3&lt;/option&gt;
    &lt;option value="4"&gt;4&lt;/option&gt;
    &lt;option value="5"&gt;5&lt;/option&gt;
    &lt;option value="6"&gt;6&lt;/option&gt;
    &lt;option value="7"&gt;7&lt;/option&gt;
    &lt;option value="8"&gt;8&lt;/option&gt;
    &lt;option value="9"&gt;9&lt;/option&gt;
    &lt;option value="10"&gt;10&lt;/option&gt;
    &lt;option value="11"&gt;11&lt;/option&gt;
&lt;/select&gt;in. or&amp;nbsp;
&lt;input id="centimeters" type="text" name="centimeters" maxlength="3" value="178" onchange="Profile.updateHeights('metric')" style="width: 30px;" /&gt;
&amp;nbsp;centimeters
</code></pre>
