[SOLVED] Day counter

This is a discussion on "[SOLVED] Day counter" within the JavaScript Forum section. This forum, and the thread "[SOLVED] Day counter are both part of the Program Your Website category.



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

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 20th, 2007, 11:36
acrikey's Avatar
SuperMember

SuperMember
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] Day counter

What have I done wrong, 0 represents Sunday and 6 represents Saturday:

Code: Select all
var Digital=new Date()
var day=Digital.getDay()
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

if (day <= 0){
    // Sunday
    document.write("Monday at 6:30");
} else if (day <= 1){
    // Monday
    document.write("Tuesday at 6:30");
} else if (day <= 2){    
    // Tuesday
    document.write("Wednesday at 6:30");
} else if (day <= 3){    
    // Wednesday    
    document.write("Thursday at 6:30");
}
} else if (day <= 4){    
    // Thursday    
    document.write("Friday at 6:30");
}
} else if (day <= 5){    
    // Friday    
    document.write("Monday at 6:30");
}
} else if (day <= 6){    
    // Saturday    
    document.write("Monday at 6:30");
}

  #2 (permalink)  
Old Nov 20th, 2007, 11:38
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: Day counter

And what doesn't work?
  #3 (permalink)  
Old Nov 20th, 2007, 11:42
acrikey's Avatar
SuperMember

SuperMember
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Day counter

The code, here it is online:

http://www.lightex.co.uk/test/moyles.htm
  #4 (permalink)  
Old Nov 20th, 2007, 11:53
acrikey's Avatar
SuperMember

SuperMember
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Day counter

Sorted, for those that were unaware of what the problem was, I had inserted too many close brackets.

HTML: Select all
else if (day <= 4){    
    // Thursday    
    document.write("Friday at 6:30");
 }
Spotted by the wife.

Cheers guys

Last edited by c010depunkk; Nov 20th, 2007 at 14:30.
  #5 (permalink)  
Old Nov 20th, 2007, 14:31
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: Day counter

Quote:
Originally Posted by acrikey View Post
Spotted by the wife.
GO WIFE!!!

Thread SOLVED and CLOSED.
Closed Thread

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
Age Counter acrikey JavaScript Forum 4 Jun 2nd, 2008 12:37
Counter confused Website Planning 6 May 21st, 2007 03:27
hit counter? skyfire400 Web Page Design 6 Mar 7th, 2006 14:00
A PHP web counter? k3nshin PHP Forum 19 Feb 19th, 2004 22:35
print "$counter times 2 is ".($counter*2)."<br>" gwx03 PHP Forum 6 Dec 10th, 2003 10:50


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


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