你没把问题说情楚,frame的url指向哪里?

解决方案 »

  1.   

    指向的不是当前地址栏显示的url.
      

  2.   

    给你试试我这个东东:),这也不是我自己写的,别人的,呵呵navigation.html
    <!--  这个文件实现了一个导航栏,它被放置在窗口底部的一个框架中。
          把它加入一个框架集的代码如下:
    -->
            <frameset rows="*,75">
            <frame src="http://localhost">
            <frame src="navigation1.html">
            </frameset>
    navigation1.html
    <script>
    // The function is invoked by the Back button in our navigation bar.
    function go_back() 
    {
        // First, clear the URL entry field in our form.
        document.navbar.url.value = "";    // Then use the History object of the main frame to go back.
        parent.frames[0].history.back();    // Wait a second, and then update the URL entry field in the form
        // from the location.href property of the main frame. The wait seems
        // to be necessary to allow the location.href property to get in sync.
        setTimeout("document.navbar.url.value = parent.frames[0].location.href;",
                   1000);
    }// This function is invoked by the Forward button in the navigation bar.
    // It works just like the one above.
    function go_forward()
    {
        document.navbar.url.value = "";
        parent.frames[0].history.forward();
        setTimeout("document.navbar.url.value = parent.frames[0].location.href;",
                   1000);
    }// This function is invoked by the Go button in the navigation bar, and also
    // when the form is submitted (when the user hits the Return key).
    function go_to()
    {
        // Just set the location property of the main frame to the URL
        // that the user typed in.
        parent.frames[0].location = document.navbar.url.value;
    }
    </script><!-- Here's the form, with event handlers that invoke the functions above. -->
    <form name="navbar" onsubmit="go_to(); return false;">
    <input type="button" value="Back" onclick="go_back();">
    <input type="button" value="Forward" onclick="go_forward();">
    URL:
    <input type="text" name="url" size="50">
    <input type="button" value="Go" onclick="go_to();">
    </form>