The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Countdown Code
IProclaim
post Jul 22 2015, 12:29 PM
Post #1





Group: Members
Posts: 2
Joined: 22-July 15
Member No.: 23,074



I am sure this is a question I should know, blush.gif but here goes hoping someone can help me.

I work for a school. We have a state exam we would like to do a countdown on our website. However there are certain "blackout" dates in which we don't attend school. They only want to count instructional days (ie school days). Is there a way to make a counter than would not count certain pre-specified days in an html code?

I do not need anything fancy just ____ days until STAAR Exam and the number to change each day.

Thank you in advance.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies(1 - 9)
Christian J
post Jul 22 2015, 01:15 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(IProclaim @ Jul 22 2015, 07:29 PM) *

there are certain "blackout" dates in which we don't attend school. They only want to count instructional days (ie school days). Is there a way to make a counter than would not count certain pre-specified days

Sounds you want the counter to change on school days only? That is, from Friday to Sunday it's 10 days left, and only on Monday the counter changes to 9 days?

QUOTE
in an html code?

Not with HTML, you need either javascript or a script on the server (like PHP). To make it wait during non-school days, perhaps the easiest might be to specify those days in an array in the script.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jul 22 2015, 01:36 PM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,731
Joined: 9-August 06
Member No.: 6



I think it's 9 days between Friday and the next Sunday. tongue.gif

I think the OP wants it to not count the days that aren't school days. To make this have any sense at all, lets change exam day to the following Friday instead. So this Friday you don't want the counter to say "It's seven days left to the exam", you want it to say "It's five school days left to the exam". Did I guess right? wink.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
IProclaim
post Jul 22 2015, 01:47 PM
Post #4





Group: Members
Posts: 2
Joined: 22-July 15
Member No.: 23,074



Well for example, we have off about 3 weeks for Christmas and 4 days for Thanksgiving, a week spring break. Plus we have weekends off. So the exam on May 2 only has 133 instructional days (as of August 24th, the first day of school). I thought I would have to use Java but the curriculum page is limited and we have been mandated to use html so I am very limited.

But yes, you are correct.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 22 2015, 03:41 PM
Post #5


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(pandy @ Jul 22 2015, 08:36 PM) *

I think it's 9 days between Friday and the next Sunday. tongue.gif

My 10 days (to the exam) was just an example. rolleyes.gif

QUOTE
To make this have any sense at all, lets change exam day to the following Friday instead. So this Friday you don't want the counter to say "It's seven days left to the exam", you want it to say "It's five school days left to the exam". Did I guess right? wink.gif

But it also must halt during the weekend. This may sound like nitpicking, but it's important when writing the script. Using your example:

CODE
End of Thursday: 8 school days left
End of Friday: 7 school days left
End of Saturday: 7 school days left
End of Sunday: 7 school days left
End of Monday: 6 school days left

With javascript you can easily check which weekday a date is, but holidays must probably be specified manually in an array.

Note that javascript gets the user's local date, so someone in another timezone will get an incorrect result if that matters. To get the web server's local time, you need a server-side script like PHP.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 22 2015, 03:44 PM
Post #6


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(IProclaim @ Jul 22 2015, 08:47 PM) *

I thought I would have to use Java but the curriculum page is limited and we have been mandated to use html so I am very limited.

Alas this is not possible with HTML alone. Also note that java and javascript are different things. Are you sure you can't use javascript? If you really can't, I guess a serverside script is not allowed either.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Mhatfield
post Jul 23 2015, 03:32 AM
Post #7


Novice
**

Group: Members
Posts: 29
Joined: 22-July 15
Member No.: 23,063



Yeah, you could use PHP for this. Make a blacklist of dates which school is not in session, holidays, weekends, etc. Then in PHP you can make a default timezone, but to be frank, that would be unnecessary due to the fact, only people in that region would attend your school, and they all have the same timezone, so that most likely is not an issue. My idea is this.

I just saw that PHP may not be allowed, so I shall wait to post my script to countdown.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jul 23 2015, 04:11 AM
Post #8


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,731
Joined: 9-August 06
Member No.: 6



QUOTE
My 10 days (to the exam) was just an example. rolleyes.gif


You said Friday to Sunday. tongue.gif
QUOTE
QUOTE
That is, from Friday to Sunday it's 10 days left


QUOTE
But it also must halt during the weekend. This may sound like nitpicking


No, it isn't nitpicking. Something must be done with holidays. I was only trying to understand what IProclaim wants to do.



User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jul 23 2015, 04:13 AM
Post #9


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,731
Joined: 9-August 06
Member No.: 6



QUOTE(IProclaim @ Jul 22 2015, 08:47 PM) *

I thought I would have to use Java but the curriculum page is limited and we have been mandated to use html so I am very limited.


Are you sure? Will school computers be used for viewing this and they've disabled JavaScript in all browsers? Because JS isn't depending on server features, only the browser it runs in.

Java is a whole nother matter. wink.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Mhatfield
post Jul 23 2015, 04:14 PM
Post #10


Novice
**

Group: Members
Posts: 29
Joined: 22-July 15
Member No.: 23,063



Java must have a compiler to, and you must have Java installed on your computers at school for users. Javascript is only dependent on whether or not the users enable it, and/or if the browser even support Javascript.

PHP is only dependent on whether or not the server the website is hosted on, has a PHP server.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 08:53 AM