要获取body的内容,可以获取 src 属性或尝试以下代码片段-
<iframe id = "myId" name = " myId ">...</iframe> <script> var myDoc; if (window.frames && window.frames. myId && (myDoc = window.frames. myId.document)) { var iframeBody = myDoc.body; var content = iframeBody.innerHTML; } </script>