Set option value with getElementsByName()
<p>Having this fieldset:</p>

<pre><code>&lt;fieldset&gt;
    &lt;legend&gt;[*death]&lt;/legend&gt;
    &lt;select name=death  style="width: 120px"&gt;
        &lt;option value=Dead&gt;[*died]
        &lt;option value=NotDead&gt;[*alive]
        &lt;option value="" selected&gt;-
    &lt;/select&gt;
&lt;/fieldset&gt;
</code></pre>

<p>i want to set the <code>[2].value</code> to <code>"-"</code>. </p>

<p>i have tried without any success:</p>

<pre><code>document.getElementsByName('death')[2].checked = 'true';
document.getElementsByName('death')[2].value = '-';  
</code></pre>

<p>Same kind of code works fine for radio boxes, checked boxes or other inputs in the form. How to do it with the option select (which is not an input)? </p>

<p>Thanks</p>

<p>[EDIT] of course, appropriate fieldset is:</p>

<pre><code>&lt;fieldset&gt;
  &lt;legend&gt;[*death]&lt;/legend&gt;
    &lt;select name="death"  style="width: 120px"&gt;
      &lt;option value="Dead"&gt;[*died]&lt;/option&gt;
      &lt;option value="NotDead"&gt;[*alive]&lt;/option&gt;
      &lt;option value="" selected&gt;-&lt;/option&gt;
    &lt;/select&gt;
&lt;/fieldset&gt;
</code></pre>

<p>thanks. </p>
