我正在编写某种由 iframe 制成的显示器。当我单击 iframe 外部的按钮时,它应该在 iframe 上纠正某些内容。可能吗?
<iframe src = "display.html" id = "ifr"></iframe>
<div class = "buttons" onClick = "showSequence()">
Get the whole sequence
</div>
javascript代码:
function showSequence(){
var iframe = document.getElementById("ifr");
(iframe.contentDocument || iframe.contentWindow.document).write("Something!");
}