4个页面:A.htmlB.html中有一个
<iframe name="main" src="C.html"></iframe>C.html D.html在点击A.html的时候通过B.html中的iframe里显示D.html

解决方案 »

  1.   

    B.html中js设置ifram的
    main.src = 'D.html';
      

  2.   

    用什么方法在点击A.html中的超链接的时候  通过B.html中的iframe框架显示出D.html
      

  3.   

    <a>标记的target = "main"
      

  4.   

    A和B不在同一框架页中  给个演示吧:
    A.html
    <html>
    <head>
    <title>A</title>
    </head>
    <body>
    <a href="">到D页面</a>
    </body>
    </html>
    B.html
    <html>
    <head>
    <title>B</title>
    </head>
    <body>
    <iframe src="C.html" name="main"></iframe>
    </body>
    </html>D.html
    <html>
    <head>
    <title>D</title>
    </head>
    <body>
    我要在B的iframe中显示
    </body>
    </html>要的效果是 只点击A页面中的超链接就跳到B中  但是B中的iframe显示的是D页面  不是B页面
      

  5.   

    假设 B.html中的iframe 的id  是 "test1",可以在 给 B 界面 的 body 添加 onload 事件
    <html>
    ……
    ……<script language="javascript">
    function changeSrc()
    {
    document.getElementById('test1').src='d.html';
    }
    </script>
    </head><body onload="changeSrc();"><iframe src="c.html"  id="test1" /></iframe>
    </body>
    <html>
      

  6.   

    刚刚的回答 不是很完善, 在 点击 A 超链接的时候  创建一个 cookie,然后 在 B的 onload 时间里 读取cookie,如果 能读取到,就执行 替换 iframe 的 src 这句话,然后 删掉 cookie,如果 没有读取到,说明 不是 A界面 点击 进来的 B界面,就不执行   替换 iframe 的 src 这句话,如果不加 判断的话, 只要打开B 都会 在 iframe中 显示 D界面
      

  7.   

    楼上这种方法行不通的哦   正常情况下打开B的时候iframe里显示的是C  只有在点击A中的超链接的时候才显示D 
      

  8.   

    你在B页面加一段js 功能是在页面加载的时候 判断时候url中有指定的参数 如果有的话 就设置iframe 的src 为D在A页面的超链接中设置指定参数即可