页面采用左右两列布局,左边为菜单导航条,右边是个iframe,根据左侧的菜单选择来切换页面内容,iframe默认有一个首页面A.html。当用F5刷新浏览器时,iframe都会变成默认页面,而不是当前页面。请问各位有什么办法没有?

解决方案 »

  1.   

    <!DOCTYPE  html  PUBLIC  "-//W3C//DTD  XHTML  1.0  Transitional//EN "  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 
    <html  xmlns= "http://www.w3.org/1999/xhtml "> 
    <head> 
    <meta  http-equiv= "Content-Type "  content= "text/html;  charset=gb2312 "  /> 
    <title>无标题文档 </title> 
    <style>
    div{
    float:left;
    }
    #d1{
    width:300px;
    height:600px;
    }
    #d2{
    width:500px;
    height:600px;
    }
    </style>
    <script>
    function changeSrc(n){
    if(n!=""){
    document.getElementById("f1").src = n;
    }else{
    document.getElementById("s1").value = "";
    document.getElementById("f1").src = "http://www.google.com";
    }
    }
    </script>
    </head> 
    <body onload="changeSrc('')"> 
    <div id="d1">
    <select id="s1" style="width:200px;" onchange="changeSrc(this.value)">
    <option value=""></option>
    <option value="http://www.baidu.com">www.baidu.com</option>
        <option value="http://www.163.com">www.163.com</option>
        <option value="http://www.csdn.com">www.csdn.com</option>
    </select>
    </div>
    <div id="d2"><iframe id="f1" width="400px" height="300px" src="http://www.google.com"></iframe></div>
    </body> 
    </html>
      

  2.   

    可以这样<!DOCTYPE  html  PUBLIC  "-//W3C//DTD  XHTML  1.0  Transitional//EN "  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 
    <html  xmlns= "http://www.w3.org/1999/xhtml "> 
    <script>
    function changeSrc(n){ 
      document.getElementById("f1").src=n;
      window.name = n;

    </script> 
    </head> 
    <body onload="if(window.name!='') document.getElementById('f1').src=window.name;"> 
    <a href="javascript:changeSrc('http://www.163.com');">163.com</a>
    <a href="javascript:changeSrc('http://www.cpp114.com');">cpp114.com</a>
    <iframe id="f1" width="400px" height="300px" src="http://www.woyaoyin.cn"> </iframe>
    </body> 
    </html>
      

  3.   

    父窗体刷新了数据没了在客户端内存里就记不住了都被释放了,最直接的办法就是使用cookie阿,或者在iframe打开的服务器端页面中记下来,记录当前用户的位置。