Changing the contents of an iframe

后端 未结 3 782
[愿得一人]
[愿得一人] 2021-01-24 01:30

I have an iframe embedded on my webpage and I\'d like to edit certain parts of it using javascript. Is this possible and how would I do it?

3条回答
  •  一向
    一向 (楼主)
    2021-01-24 01:43

    You can get the iframe document by doing this:

    document.getElementById(iframeId).contentDocument
    

    That is if you own the page loaded in the iframe.

提交回复
热议问题