Hello Guys n Girls.
I have a problem. I am an OKish web designer (i taught myself stuff) any way. I am looking for a java script code that counts down to a certain hour monday-thursday and then counts down to a different hour on friday (i dont care about the weekends) Monday-Thursday it has to count down to 2:00 pm and friday it counts down to 12 pm PLEASE HELP thanks
Piece of cake. I can write that in about ten minutes. I just need to know what is supposed to happen once the clock hits 2:00pm/12:00pm. Is some text supposed to display or something?
I'm about to pack up my computer, but if you answer then I can have something posted later this evening...if no one else has posted anything, that is.
Here is my attempt, still personally interested to know how lonogod will do it:
<meta charset="utf-8" />
border: 1px solid #000;
window.onload = function()
text = document.getElementsByTagName('body').appendChild(document.createElement('div')),
days = [
text.className = 'CountDown';
date = new Date(), time, h, m, s, x;
time = Math.max(Math.floor(((new Date(date.getFullYear(), date.getMonth(), date.getDate(), days[date.getDay()], 0, 0).getTime()) - date.getTime()) / 1000), 0);
x = (time % 3600);
h = (time - x) / 3600;
s = (x % 60);
m = (x - s) / 60;
text.innerHTML = (h < 10 ? '0' : '') + h + ':' + (m < 10 ? '0' : '') + m + ':' + (s < 10 ? '0' : '') + s;
Last edited by bionoid; 10-04-2013 at 05:41 PM.
Reason: Relocated days array for single creation
I'm sorry, just got home from a LOOOONG day. You still haven't responded though, so I guess it's not a big deal. I'm headed to bed but will try to get to it this weekend. Probably will have to wait until Monday when I'm back at work though. Even if someone else gives you exactly what you're looking for, I'll post mine just for the heck of it.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)