📜  iframe getelementbyid - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:03.360000             🧑  作者: Mango

代码示例2
const iframe = document.getElementById("myIframe");

const iWindow = iframe.contentWindow;
const iDocument = iWindow.document;

// accessing the element
const element = iDocument.getElementsByTagName("p")[0];
element.style.color = "green";