//index.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<frameset rows="80,*" frameborder="no" border="0" framespacing="0">
  <frame src="http://www.baidu.com" name="topFrame" id="topFrame" title="topFrame" />
  <frame src="test.html" name="mainFrame" id="mainFrame" title="mainFrame" /></frameset>
<noframes>
<body></body>
</noframes>
</html>//test.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<script type="text/javascript">
function saveHtml() {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.OpenTextFile("C:\\a.html", 2, true);
f.Write(document.documentElement.outerHTML);
f.Close();
fso = f = void(0);
} document.writeln(window.parent.frames.length);
document.writeln(document.title);
mywindow = window.parent.frames[0];
document.writeln(mywindow.document.title);

</script>
</body>
</html>请问访问不对吗?

解决方案 »

  1.   


    //修改后的test.html
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <script type="text/javascript"> document.writeln(window.parent.frames.length);
    document.writeln("<br>");
    //document.writeln(document.title);
    mywindow = window.parent.frames[1];
    document.writeln("document.frames[1]'s title is:");
    document.writeln(mywindow.document.title);
    document.writeln("<br>");
    mywindow = window.parent.frames[0];
    document.writeln("document.frames[0]'s title is:");
    document.writeln(mywindow.document.title);

    </script>
    </body></html>
      

  2.   

    AJAX,给你看个推荐帖
    http://topic.csdn.net/u/20081224/09/26aff992-d0ba-4f6f-a023-e0e96ecbe1fc.html?96078
      

  3.   

    如果不是本地应用的话,浏览器同源策略限制了不能跨域访问。
    http://www.zainanbao.com