【发布时间】:2021-07-18 08:01:12
【问题描述】:
您好,我想使用document.querySelector() 查找span id='t1',但我不知道如何访问#document 元素和其中的任何内容。有没有办法在#document 中选择元素?
我在这里使用来自“timeanddate”网站的 html 时钟。
【问题讨论】:
标签: html document queryselector
您好,我想使用document.querySelector() 查找span id='t1',但我不知道如何访问#document 元素和其中的任何内容。有没有办法在#document 中选择元素?
我在这里使用来自“timeanddate”网站的 html 时钟。
【问题讨论】:
标签: html document queryselector
您在此处处理的是 iFrame,它是 HTML 中的一段网站。
您可以使用这种方法访问它:
document.getElementById('myframe').contentWindow.document
【讨论】: