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
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
Comment