【问题标题】:How to access nested #document in html? [duplicate]如何在html中访问嵌套的#document? [复制]
【发布时间】:2021-07-18 08:01:12
【问题描述】:

您好,我想使用document.querySelector() 查找span id='t1',但我不知道如何访问#document 元素和其中的任何内容。有没有办法在#document 中选择元素?

我在这里使用来自“timeanddate”网站的 html 时钟。

【问题讨论】:

    标签: html document queryselector


    【解决方案1】:

    您在此处处理的是 iFrame,它是 HTML 中的一段网站。

    您可以使用这种方法访问它: document.getElementById('myframe').contentWindow.document

    【讨论】:

      猜你喜欢
      • 2017-06-27
      • 1970-01-01
      • 1970-01-01
      • 2020-10-25
      • 2019-08-25
      • 1970-01-01
      • 2019-01-19
      • 1970-01-01
      • 2017-05-30
      相关资源
      最近更新 更多