您好我正在尝试从 html 选择元素中获取选项。我正在使用的逻辑在 Firefox 中工作,但在 IE 中不起作用。它给了我选项数组的长度或选项的数量,但它没有给我选项的值。我该如何解决这个问题?
var SelectId= 'select_1'; //id of the html select element
options = document.getElementById(SelectId).options;
alert(options.length);
for(var o=0;o< options.length;o++)
{alert(options[o].value);}