日期:2014-05-16  浏览次数:20340 次

能读frame里的BODY里的内容吗?
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Frameset//EN "   "http://www.w3.org/TR/html4/frameset.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=utf-8 ">
<title> 无标题文档 </title>
<script> alert(document.getElementsByTagName( 'mainFrame ').body) </script>
</head>

<frameset   rows= "80,* "   frameborder= "NO "   border= "0 "   framespacing= "0 ">
    <frame   src= "UntitledFrame-2.html "   name= "topFrame "   scrolling= "NO "   noresize   title= "topFrame "   >
    <frame   src= "Untitled-1.html "   name= "mainFrame "   title= "mainFrame ">
</frameset>
<noframes> <body>
</body> </noframes>
</html>


------解决方案--------------------
可以
window.frames[ "frame_name "].document.body就可以获得frame的页面的body对象
读内容可以用window.frames[ "frame_name "].document.body.innerHTML