SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    scheduled redirect

    I'm trying to direct visitors to a given page according to business hours. I'm a total newbie at js, so I'm probably making lots of syntax errors. Here's what I have. The schedule is 7:30am to 3:30pm, Monday through Friday:

    Code:
    todaydate = new Date();
    timeis=todaydate.getTime();
    todaydate.setTime(timeis);
    houris = todaydate.getHours();
    mins = todaydate.getMinutes();
    dayis = todaydate.getDay();
    if(dayis>0 && dayis>1 && (((houris*60) + mins)<=930) && (((houris*60) + mins)>=450)) {
    location.href='http://www.website.com/main/businesshours.htm';
    }
    
    else{location.href='http://www.website.com/main/afterhours.htm';
    }
    I seem to be having a problem with the value that 'dayis' is returning...

  2. #2
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, this was an easy one. First, I got my day numbers wrong, 6 is Saturday, 0 is Sunday. More importantly:

    this
    Code:
    if(dayis<6 && dayis>0
    needs to be like this
    Code:
    if(dayis < 6 && dayis > 0
    Spaces.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •