SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    automatically pick next bussiness day

    Hi,
    I'm not too experienced in this field but I know some.
    I'm fixing up an eCommerce website and I want to add an feature - that on top of the add to cart button it should say let's say it's sunday "Orders placed now will ship monday" like this website http://robertscamera.com/photo/point...pix-s4000.html it should always write the next bussiness day.
    I started something but it's not close to what I want:

    <html>
    <body>

    <script type="text/javascript">

    var d=new Date();
    var weekday=new Array(7);
    weekday[0]="Sunday";
    weekday[1]="Monday";
    weekday[2]="Tuesday";
    weekday[3]="Wednesday";
    weekday[4]="Thursday";
    weekday[5]="Friday";
    weekday[6]="Saturday";

    document.write("Orders placed now will ship " + weekday[d.getDay()]);

    </script>

    </body>
    </html>
    Thanks.
    Hersh.

  2. #2
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If this isn't a homework exercise, there are a couple of other issues you might need to consider as well.

    1) What if Monday is a public holiday?

    2) This is probably better done server side because it won't work in browsers where javascript is disabled for some reason

  3. #3
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've got this http://blog.agilelogicsolutions.com/...avascript.html
    but I just don't know how to fit it in to work

  4. #4
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, so it looks like this is a homework exercise of some kind and not a "real world" application.


Tags for this Thread

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
  •