Rotating URL website Code

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all,

I've searched this to death but didn't find much.

Basically we have a plasma screen in our office which has to look at
about 4 different websites (bbc news etc) on a regular basis.

I wrote a nice little array which half works but doesn't load the
pages properly. Code is:

$pages = array(
' ',' ','http://');

Basically after 60 seconds I'd like to randomly show one of the news

If anyone can help point out where I'm going wrong or a better way to
do this it would be excellent. I'd like to learn how to fix this, as
well as find a solution so anyone willing to offer a little tutorial
would be most appreciated.



Re: Rotating URL website Code

I've done some further work on this and realise that its loading the
URLs in the same page and thus thats why CSS and some images don't
work as it looks for them on my server (which they obviously aren;t).

I guess the best way is to have this page running and basically it
auto changes another IE window by setting it to load it in a different

Obviously I need to add the header reload/refresh so the script
continues to run, but I'm still trying to work that out too!

Re: Rotating URL website Code

Sibine wrote:

Quoted text here. Click to load it

Using Javascript and frames. Two frames. Very thin one at the top. Very  
big one underneath. In the top frame, call a Javascript function every 60  
seconds, that loads a URL into the bottom frame. Easy.

Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux, up 17 days, 5:21.]

                      Gnocchi all'Amatriciana al Forno

Re: Rotating URL website Code

If any of the sites have some sort of anti-frame javascript, you may
have problems - but worth trying. Another option may be to have four
(or however many) browser windows open to the correct pages, and some
sort of code on the actual computer to shuffle through them somehow...

www.NEXCESS.NET - Shared/Reseller Hosting - Dedicated Servers, Server Clusters - Virtual Private Servers
- Great prices, Great service - check us out!

Quoted text here. Click to load it

Re: Rotating URL website Code

adwatson wrote:
Quoted text here. Click to load it

There might be some browser plugins/addons as well.


Re: Rotating URL website Code

Thanks very much for all your help. I'll try the frames out later and
see how it goes :)

Re: Rotating URL website Code

Quoted text here. Click to load it

try this one that I amended specially for you to work with Iframe...
You can drop the top menue and autostart the script.
<script language="JavaScript">
<!-- Begin
var repeatshow = 1; // 1 = yes, 0 = no
var timedelay = 10000; // time in milliseconds, 5000 = 5 secs

var page = new Array(
" ",
" /",
" /",
" /",
" /",
" /",
" /"

); // note no comma after last page!

// your "the end" page.  Necessary if repeatshow = 0;
var endpage = " ";

var slidenum = 0;
var slidecount = page.length;
var timerID = 0;
var win2;
function showSlideShow() {
if (slidenum < slidecount+1) {
parent.main.location.href = page[slidenum-1];
if (slidenum == slidecount+1) { // if finished
if (repeatshow) {
slidenum = 0;
timerID = setTimeout('showSlideShow()', timedelay)
else parent.main.location.href = endpage;
else timerID = setTimeout('showSlideShow()', timedelay);
// End -->


<BODY onload="timerID=setTimeout('showSlideShow()',timedelay)">

<a href="javascript:showSlideShow();"
onClick="clearTimeout(timerID)">Cycle Pages</a>    ..........
<a href="#"  onClick="clearTimeout(timerID)">STOP</
a>     ..........
<a href=" " target="main"

<IFRAME SRC="main.html"  name="main" WIDTH=100% HEIGHT=95%>




Good luck

Site Timeline