Home >Web Front-end >HTML Tutorial >iframe parent-child page operation-two easy-to-use methods-window.parent/oframe.contentWindow.document_html/css_WEB-ITnose
I found a more useful method of operating iframe parent-child pages, record it
1. Parent page test.html
Get iframe var oframe = document. getElementById("main")
Get the subpage var child = oframe.contentWindow.document
Get the subpage Element var test = child.getElementById("test")
Get the child page height var childh = child .body.offsetHeight
Get the sub-page height
2. Sub-page iframe.html
Get the parent page var parent = window.parent.document
Note: The code needs to be placed on the server side to be compatible with Google Chrome