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