title: Selected value dropdownbox using javascript
body: <p>With this script I fill the dropdownbox dynamicly:</p>
  
  <pre><code>function loadDropbox(boxName,checkBox,selected){
      var htmlStr="";
      var searchXML = new ActiveXObject("Msxml2.DOMDocument");
      searchXML = getXML("WEBDRPO0;?BDR="+bdr+"&amp;TYPE_ART=D");
      var nodeList = xmlDoc1.documentElement.selectNodes("//box[@name='"+boxName+"']");
          try{
      for(i=0;i&lt;nodeList.length;i++){
      var vals = ""+nodeList[i].firstChild.nodeValue+"";
      vals = vals.split("~");
      for(i=0;i&lt;vals.length;i++){
      if(checkBox=='1'){
          htmlStr+="&lt;br /&gt;&lt;label&gt;&lt;input type=checkbox name='aanwezigheid' id='aanwezigheid' value="+vals[i]+" id="+vals[i]+"/&gt;"+vals[i]+"&lt;/label&gt;&lt;br/&gt;";
      }else if(selected == vals[i]){
          htmlStr+="&lt;option selected='selected'&gt;"+vals[i]+"&lt;/option&gt;";
      }else{
          htmlStr+="&lt;option&gt;"+vals[i]+"&lt;/option&gt;";
                  }
              }
          }
      }   
      catch(e){}
      return htmlStr;
  }
  </code></pre>
  
  <p>This is the HTML result:</p>
  
  <pre><code>&lt;select id="year" name="year"&gt;
    &lt;option&gt;--Make Choice--&lt;/option&gt;
    &lt;option&gt;1980 - 1990&lt;/option&gt;
    &lt;option&gt;1990 - 2000&lt;/option&gt;
    &lt;option&gt;2000 - 2010&lt;/option&gt;
    &lt;option&gt;2010 - later&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>With this Javascript I would make the "2010 - later" value the seleceted value. </p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript"&gt;
  document.getElementById("year").value = "2010 - later";
  &lt;/script&gt;
  </code></pre>
  
  <p>It works fine in Firefox, but it don't work in IE9.
  What am I doing wrong?</p>
  
  <p>Regards,</p>
  
  <p>Freexel</p>