How to redirect to a page based on system date?

Discussion in 'JavaScript' started by anusha, Apr 9, 2006.

  1. #1
    I am looking for a script that would allow me to redirect to a particular page based on user's system date.

    Here is an example..

    Say I have a site.. xyz.com and abt 365 pages, which would cover the whole year..

    If a person visits xyz.com on say April 20th, I want the index page to redirect to the page corresponding to April 20th.

    ~ Anu
     
    anusha, Apr 9, 2006 IP
  2. anusha

    anusha Active Member

    Messages:
    588
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    68
    #2
    For redirection based on day of the week, teh following works,...

    <script language="JavaScript"><!--
    function makeArray() { for (i = 0; i<makeArray.arguments.length; i++) this = makeArray.arguments; }

    var daysArray = new makeArray('sunday','monday','tuesday','wednesday','thursday','friday','saturday');

    var today = new Date(); // get todays date
    var dotw = today.getDay(); // get the day of the week
    // Sunday = 0, Monday = 1 ... Saturday = 6

    location.href = daysArray[dotw] + '.htm';
    //--></script>
     
    anusha, Apr 9, 2006 IP
  3. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #3
    What the heck Anusha, you ask a question on the forum and then you answer your own question. Ha ha.
     
    profs77, Apr 10, 2006 IP
  4. pushkar

    pushkar Peon

    Messages:
    125
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    But do u want to do like this??Do u want to make AprilFull someone???
     
    pushkar, Nov 3, 2006 IP
  5. Shamsher Nawaz

    Shamsher Nawaz Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Looks like anusha got the 606 post doing like this. haa haaaa.
     
    Shamsher Nawaz, Nov 9, 2006 IP