Following code creates select list dynamically. I wanna find the way to select all values in created select list, but nothing seems to be work with ie. All other browsers works fine. Have not find yet any solution for this problem even search many times all over the net.
[code=php] var selectlist = document.createElement(‘select’);
selectlist.id = ‘id’;
selectlist.multiple = “multiple”;
selectlist.size = “6”;
var options = new Array(“first”,”second”,”thrid”,”fourth”,”fifth”);
for (var i=0;i<options.length;i++) {
option = document.createElement(‘option’);
option.appendChild(document.createTextNode(options[i]));
option.value = options[i];
option.selected = true;
selectlist.appendChild(option);
}
getObject(“placeInHTML”).appendChild(selectlist);
for (var i=0;i<form[‘id’].options.length;i++) {
for (var k=0;k<options.length;k++) {
if (form[‘id’].options[i].value == options[k].trim()) {
form[‘id’].options[i].selected = true;
break;
}
}
}
getObject is the function which return div-element on the html.