Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在设置一个带有 2 个框架的框架集的 HTML 页面。我想在一个框架上启动一个操作,该操作将修改另一框架中的某些内容。例如,单击第 1 帧上的按钮会更改第 2 帧上具有 id 的元素的 innerHTML。
我该怎么做呢?
谢谢
您可以在第 1 帧中的某些事件上触发以下 javascript:
window.parent.frame2.document.getElementById('element_id').innerHTML = 'new content';
假设第 2 帧元素的名称为“frame2”,而您要修改的元素的 id 为“element_id”。