我有一个页面A,在页面A中有一个iframe,iframe的src是诸如百度,新浪的网站链接,现在我想在iframe里面的url变化时,在页面A的显示(有个地方显示iframe地址)也同时变化,请问如何实现?

解决方案 »

  1.   

    我试着将远程页面源文件保存成本地文件,然后再载入,结果用php写文件时却提示没有权限,不知道怎么回事
      

  2.   

    <iframe src="www.baidu.com"></iframe>
      

  3.   

    这我当然知道问题是当iframe里面的url变了,我要获取到最新的url
      

  4.   

    不知道楼主是不是要的这种效果。<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>自定义title - 5iuu.com</title>
    </head>
    <body>
    <input type="radio" name="ra"  id="1"/>新浪<br/>
    <input type="radio" name="ra" id="2" />腾讯<br/>
    <input type="radio" name="ra" id="3"/>网易<br/>
    <input type="button" value="选择" onclick="ReturnValue()"/>
    <input type="text" id="txt" width="100px" value="http://www.baidu.com"/>//用于显示url网址
    <iframe id="fram" src="http://www.baidu.com" style="width:600px;float:left;height:500px"></iframe>
    <script>
    function ReturnValue() 
    {
     var name=""; if(document.getElementById("1").checked)
      name="http://www.sina.com";
     if(document.getElementById("2").checked)
      name="http://www.qq.com";
     if(document.getElementById("3").checked)
      name="http://www.126.com";
    document.getElementById("fram").src=name;
    document.getElementById("txt").value=name;}
    </script>
    </body>
    </html> 
      

  5.   

    我的意思是iframe里面的页面手动用鼠标去点击跳转页面,如何获取新的页面的url
      

  6.   

    加载了人家的页面,新的页面不一定会在iframe里吧,会自动打开新窗口的
      

  7.   

    window.parent.frames['frame_name'].document.getElementById("id").value = "地址"(或者innerHTML = "地址")试一试
      

  8.   

    恩,如果是新页面就不管他了,如果是自身页面跳转,如何获取呢,另外我成功的把网页内容写到我服务器上,然后载入到iframe中,但是有些网页显示不出来
    to:10楼,你那个语句怎么用呢,放在哪
      

  9.   

    frames中的任何页面,不知道灵不灵
      

  10.   

    alert(window.frames['frameName'].window.location);
      

  11.   

    写个每个100毫秒获取IFRAME中的SRC的值。如与上次不同则执行你要的方法!