choose an option based on a textbox value
<p>We are doing a form, asking a user to enter a price.</p>

<p>The user enters a price in input field of say <code>456789</code>.</p>

<p>I would like it so the selectbox element automatically chooses the 400,000 - 500,000 option</p>

<p>How can this be done?</p>

<pre><code>&lt;div class="field"&gt;
    &lt;label for="propertyprice"&gt;Price&lt;/label&gt;
    &lt;input id="currency2" name="limitedtextfield" size="50" 
           type="text" class="medium" 
           onKeyPress="return numbersonly(event, false)"
           onKeyDown="limitText(this.form.limitedtextfield,this.form,12);"
       onKeyUp="limitText(this.form.limitedtextfield,this.form,12);"
           maxlength="12" value="$&lt;?=number_format($r['price'],2);?&gt;" /&gt;
    &lt;p class="field_help"&gt;Enter only numbers.&lt;/p&gt;&lt;/div&gt;

    &lt;div class="field"&gt;
    &lt;label for="propertypricerange"&gt;Price Range &lt;/label&gt;
    &lt;select id="propertypricerange" name="propertypricerange" class="medium"&gt;
          &lt;optgroup label="Enter Price Range"&gt;
            &lt;option selected="selected" value="0"&gt;0    -    $100,000&lt;/option&gt;
            &lt;option value="100000"&gt;$100,000    -    $200,000&lt;/option&gt;       
            &lt;option value="200000"&gt;$200,000    -    $300,000&lt;/option&gt;
            &lt;option value="300000"&gt;$300,000    -    $400,000&lt;/option&gt;
            &lt;option value="400000"&gt;$400,000    -    $500,000&lt;/option&gt;       
            &lt;option value="500000"&gt;$500,000    -    $600,000&lt;/option&gt;       
            &lt;option value="600000"&gt;$600,000    -    $700,000&lt;/option&gt;       
            &lt;option value="700000"&gt;$700,000    -    $800,000&lt;/option&gt;       
            &lt;option value="800000"&gt;$800,000    -    $900,000&lt;/option&gt;       
            &lt;option value="900000"&gt;$900,000    -    $1,000,000&lt;/option&gt;     
            &lt;option value="1000000"&gt;$1,000,000    -    $2,000,000&lt;/option&gt;      
            &lt;option value="2000000"&gt;$2,000,000    -    $3,000,000&lt;/option&gt;      
            &lt;option value="3000000"&gt;$3,000,000    -    $4,000,000&lt;/option&gt;      
            &lt;option value="4000000"&gt;$4,000,000    -    $5,000,000&lt;/option&gt;      
            &lt;option value="5000000"&gt;$5,000,000    -    $10,000,000&lt;/option&gt;
         &lt;/optgroup&gt;
      &lt;/select&gt;
&lt;/div&gt;
</code></pre>
