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.
在 HTML 文件中包含一个外部 js 文件,在 js 文件中我使用了这种方法:
window.parent.document.getElementById("someID").innerHTML='something';
但它不起作用
是否window.parent因为要引用 JS 文件的父级而包含该部分?这不是它的工作方式 - JS 在包含它的 HTML 的上下文中运行,所以你只需要:
window.parent
document.getElementById("someID").innerHTML='something';
(如果我误解了你的问题,请原谅我!)