Forum Moderators: open

Message Too Old, No Replies

Display sequential html page

         

jackdack

11:42 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



Do you have or know of a script which will make a page pull in another page each time it loads? I've seen it done for images, and also randomized pulling in other pages but I need it to work sequentially not randomized.
Thank you

Bernard Marx

12:13 am on Aug 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"sequencially" - Does that mean that the pages (are all in the same dir, and) have filenames:

someName1.htm
someName2.htm

Or do you have some other naming system (a list)?

jbinbpt

12:19 am on Aug 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What do you wat to trigger the next page to reload? Time? User action?
Are the pages static or dynamic?

jackdack

3:02 am on Aug 5, 2005 (gmt 0)

10+ Year Member



Sequential meaning one page after another, loaded each time using a meta refresh.

It needs to load the page within the current page (I've seen it done using iFrame but guess there are probably other ways. Some online photo galleries use similar functionality)

eg. loading pages from multiple different sites, sequentially on each page load
[server1.com...]
[server2.com...]
[serveradb.com...]
[serverueeueueu.com...]

Thank you

Bernard Marx

5:15 am on Aug 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This works in IE & Firefox.
May need a tweak for some other browser, due to frame & frame window referencing variations.

[blue]-- markup --- 
[/blue]<!-- give name & id to frame -->

<iframe id="inner" name="inner" width="400" height="400"></iframe>

[blue]-- script ---[/blue]

var urls =
[
'www.example1.com',
'www.example2.com',
'www.example3.com'
];

var iCurr = -1;

var timer = setInterval("loadPage()", 7000)

function loadPage()
{
var frameWin = document.frames¦¦window.frames;
frameWin.inner.location = 'http://'+ urls[++iCurr];
if(iCurr==urls.length)
clearTimeout(timer);
}

Bernard Marx

5:49 am on Aug 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In fact, change the function to this - it's simpler:

function loadPage()
{
document.getElementById('inner').src = 'http://'+ urls[++iCurr];
// etc
}

jackdack

11:45 pm on Aug 7, 2005 (gmt 0)

10+ Year Member



great, I'll give it a go, thanks for your help