Countdown Code |
Countdown Code |
IProclaim |
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, 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. |
Christian J |
Jul 22 2015, 01:15 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
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. |
pandy |
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.
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? |
IProclaim |
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. |
Christian J |
Jul 22 2015, 03:41 PM
Post
#5
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
I think it's 9 days between Friday and the next Sunday. My 10 days (to the exam) was just an example. 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? 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. |
Christian J |
Jul 22 2015, 03:44 PM
Post
#6
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
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. |
Mhatfield |
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. |
pandy |
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. You said Friday to Sunday. 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. |
pandy |
Jul 23 2015, 04:13 AM
Post
#9
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,731 Joined: 9-August 06 Member No.: 6 |
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. |
Mhatfield |
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. |
Lo-Fi Version | Time is now: 26th April 2024 - 08:53 AM |