links array not updating

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tommy

    links array not updating

    Hi,

    I have 3 frames. One to let the user input a URL, one to display the
    page of that URL and one to display some info on that page (including
    all the links of the page).

    The problem is that when loading a new page into the frame, the links
    do not update in the other frame until I've loaded the page twice. It
    appears that the actual values in the links array do not update until
    after loading for the 2nd time. This is my script:

    function loadNewUrl()
    {
    var i;
    var theNewURL

    // Load the new web page into the left frame

    parent.leftWind ow.location=doc ument.url_input .url.value;

    theNewURL = document.url_in put.url.value;

    // Display the url of the new web page in the right frame
    parent.rightWin dow.document.cl ose();
    parent.rightWin dow.document.op en();
    parent.rightWin dow.document.wr ite("<B> URL: </B>");
    parent.rightWin dow.document.wr ite("<br>");
    parent.rightWin dow.document.wr ite(theNewURL);
    parent.rightWin dow.document.wr ite("<br> <br>");

    // Display all the link targets of the new web page in the right frame
    parent.rightWin dow.document.wr ite("<B> LINKS: </B>");
    parent.rightWin dow.document.wr ite("<br>");

    for(i=0; i<parent.leftWi ndow.document.l inks.length; i++)
    {
    parent.rightWin dow.document.wr ite(parent.left Window.document .links[i].href);
    parent.rightWin dow.document.wr iteln("<br>");

    }

    parent.rightWin dow.document.cl ose();
    }
    //-->
    </script>


    Can anyone see a reason why this shouldn't work?

    Thank you - in advance
    tommy
  • Lee

    #2
    Re: links array not updating

    Tommy said:[color=blue]
    >
    >Hi,
    >
    >I have 3 frames. One to let the user input a URL, one to display the
    >page of that URL and one to display some info on that page (including
    >all the links of the page).
    >
    >The problem is that when loading a new page into the frame, the links
    >do not update in the other frame until I've loaded the page twice. It
    >appears that the actual values in the links array do not update until
    >after loading for the 2nd time. This is my script:[/color]
    [color=blue]
    >
    >Can anyone see a reason why this shouldn't work?[/color]

    It takes time for a page to load into a frame.
    You're trying to access the list of links in the first frame before
    the page has finished loading.

    Comment

    Working...