Refresh at Specific Time of Day

This is a discussion on "Refresh at Specific Time of Day" within the JavaScript Forum section. This forum, and the thread "Refresh at Specific Time of Day are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 21st, 2007, 11:20
New Member
Join Date: Aug 2007
Location: UK
Age: 24
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Refresh at Specific Time of Day

Im looking for some help on an automatic page refresh at a specific time of day. This refresh needs to redirect to an alternate page. The basic process of this is as follows. The page which refreshes at a certain time is left open on a computer. This page will have specific redirects at different times of the day to active other pages which tasks are like send an automated email to someone at one time and update a database at another. These pages have been made already and will redirect back to the first page once they are done. So all i need is some help on the redirect refresh on the first page. Thanks in advance.
Reply With Quote

  #2 (permalink)  
Old Sep 1st, 2007, 17:14
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Refresh at Specific Time of Day

Code: Select all
 
<script type="text/javascript">
 
// Get the current time as at page load
var curTime = new Date();
 
// Create an array with an index for all hours of the day
var actions  = new Array(24);
 
// add the URL to the corresponding hour in the array
actions[8]   = "http://8oclockam.example.com";
 
 
function tickMinutes()
{
 
     // Check to see if we are crossing an hour
      if (curTime.getMinutes() + 1 === 60)
      {
             //Increase the hours and set minutes back to 0
             // If this hour has a url, we'll send the window there
              curTime.setHours(curTime.getHours() + 1);
              curTime.setMinutes(0);
              if (actions[curTime.getHours()])
              {
                    window.location.href = actions[curTime.getHours()];
                    
               }
       } else {
      curTime.setMinutes(curTime.getMinutes() + 1);
      }
      // Check again in one minute.
      window.setTimeout('tickMinutes()', 60000);
}
</script>
I haven't testing this but it should work I think..
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
Reply

Tags
redirect, refresh, time

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop the browser refresh on clicking the webbrowser's refresh button ? camarun20 JavaScript Forum 3 Mar 18th, 2008 23:04
When Refresh go 1 again gncreditcards Web Page Design 2 Jan 30th, 2008 18:24
Loading specific flash movies for specific pages koonkle Flash & Multimedia Forum 3 May 22nd, 2007 17:23
How does a page refresh? flox74 Web Page Design 8 May 8th, 2006 19:41
Adjusting time from server time to local time Tim356 Classic ASP 10 Jun 21st, 2004 14:57


All times are GMT. The time now is 10:34.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43