我试图通过在我的 iframe 中设置 JS 来操作 iframe 之外的元素 style.backgroundColor 代码有效但不是 innerHtml
我有
<script type="text/javascript">
//get main document element.
var ititle= parent.document.getElementById('MainTitle');
//works
ititle.style.backgroundColor = "#FFCC00";
//doesn't work
ititle.innerHtml='test html';
</script>
上面的脚本在我的 iframe 里面
有什么原因吗?非常感谢。