“iframe getElementById” Kod odpowiedzi

iframe getElementById

document.getElementById('myframe1').contentWindow.document.getElementById('x')
Relieved Reindeer

Jak uzyskać element w iframe za pomocą JavaScript

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";
Thoughtful Turtle

Odpowiedzi podobne do “iframe getElementById”

Pytania podobne do “iframe getElementById”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu