hrhs
asked on
Business Hours text according to time and/or day
I must have tried a 100 variations of this code and can't seem to get it right. I feel like I'm walking further off the playing field.
I want to display a message on our pages that show whether our business is open or closed depending on time and/or day.
Here is my current code.
and the HTML I'm currently using.
I want to display a message on our pages that show whether our business is open or closed depending on time and/or day.
Here is my current code.
<script type="text/javascript">
var today = new Date()
var open = ("We're open today from 9am - 5pm</span>");
var closed = ("We're closed and will open again tomorrow 9am - 6pm</span>");
if (today == 0) display.innerHTML = 'closed';
if (today.getHours() >= 9 && today.getHours() < 18) {
display.innerHTML = 'open';
} else {
display.innerHTML = 'closed';
}
</script>
and the HTML I'm currently using.
<div><span id="display"></span></div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window