innerHTML替换不反映

Sou*_*abh 5 javascript internet-explorer innerhtml

我有像这样的HTML

<div id="foo">
<select>
<option> one </option>
</select>
</div>
Run Code Online (Sandbox Code Playgroud)

我用的时候

document.getElementById('foo').innerHTML = document.getElementById('foo').innerHTML.replace("<option> one </option>", "<option> two </option>") ;
Run Code Online (Sandbox Code Playgroud)

innerHTML被替换但它没有在浏览器中反映出来.

如果我提醒innerHTML,我可以看到它现在已被更改,但在浏览器中它仍显示旧选项.

有没有办法让浏览器识别出这种变化?

提前致谢.

Rus*_*Cam 7

在Firefox 3.5中适用于我

工作演示

编辑:你必须使用IE浏览器.您需要创建一个新选项并将其添加到元素,或修改现有选项的文本

工作演示 - 在FireFox和IE 7中测试和工作.

var foo = document.getElementById('foo');
var select = foo.getElementsByTagName('select');
select[0].options[0].text = ' two ';
Run Code Online (Sandbox Code Playgroud)