How to change the selectedIndex of a select element using getElementById
<p>I want to do something similar to this but I am unable to change the selectedIndex value this way:</p>

<pre><code>var selected = document.getElementById("state-select");



switch (state) {
                    case 'VA':
                        selected.options[selected.selectedIndex] = 0;
                        break;
                    case 'NC':
                        selected.options[selected.selectedIndex] = 1;
                        break;
                    case 'SC':
                        selected.options[selected.selectedIndex] = 2;
                        break;                       

}
</code></pre>
