Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripts for Rotating web pages(HTML) 1

Status
Not open for further replies.

30101

Technical User
May 22, 2002
18
GB
Hi,
I have a single page(index.html) website which is used locally to display information from access database.
I have decided to add more pages (x.html, y.html,z.html).These pages are not link with the database but for displaying banners, adverts etc. Is there a script if inserted to the master page will at a set time interval trigger the secondary pages to show sequentially.
( The kind you see with rotating photos, banners). I don't want a link that require any user input.

Thank you for your help

eddie
 
Let's say you want to display the pages as follows:
Code:
   start: page1.html
   after 1 minute: page2.html
   after 2 minutes: page3.html
   after 3 minutes: back to page1.html
Then you will need this code in [tt]page1.html[/tt]
Code:
   <script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;>
      function nextPage(aName, aMinutes) {
         window.setTimeout(&quot;document.location = \&quot;&quot; + aName + &quot;\&quot;;&quot;, aMinutes * 1000);
         return;
      }
   </script>
   ...
   <body onload=&quot;nextPage('page2.html', 1);&quot;>
   ...
   </body>
In [tt]page2.html[/tt] put the same code but with [tt]'page3.html'[/tt] instead of [tt]'page2.html'[/tt] and so on...

You can change the delay by changing the [tt]1[/tt] to, say, [tt]2.5[/tt] (for two-and-a-half minutes).

Hope this helps.

________________________________________
[hippy]Roger J Coult; Grimsby, UK
In the game of life the dice have an odd number of sides.
 
Dear woja,
Thank you for your speedy response and most valuable tip, just a little problem with the code though, when I try to load the child page in internet explorer 6, I can only see a blank page with all the contents disappear.

Any ideas?
Thank you once again.
eddie
 
Also, this requires javascript you an instead use meta refresh then it will work on more browsers.
META HTTP-EQUIV=Refresh CONTENT=&quot;10; URL=http://www.yoursite.com/nextpage.html&quot;>

note that the 10 is the number of secods before a refresh.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top