
February 17th, 2008, 10:36 AM
|
 |
Contributing User
|
|
Join Date: Mar 2006
Location: Maine, USA
|
|
It has been a very long time since i have done anything with Javascript.
However, I know that this would be fairly simple in VBScript - but then again, javascript is built into more browsers than vbs.
It should be about the same though.. so let me look up some JS functions real quick...
Code:
var openHour = 9;
var closeHour = 17;
var hour = now.getHours();
var open = false;
if (hour > openHour) [ open = true ]
if (hour > closeHour) [open = false]
if (open) [ document.write('Open for business!') ]
else [ document.write('Sorry, we're closed!') ]
I would think that should do the trick.... If you need to break it down into minutes, etc. it would just be a matter of assigning a minute variable and checking that as well.
|