Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   Dev Hardware ForumsSOFTWAREProgramming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Hardware Forums Sponsor:
  Trader Rating: 0 · #1  
Old February 16th, 2008, 08:55 PM
drumz0rz's Avatar
drumz0rz drumz0rz is online now
Custom User Title:
Click here for more information. Click here for more information
Click here for more information
 
Join Date: Jun 2004
Location: NY
Posts: 5,283 drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)drumz0rz User rank is General 64th Grade (Above 100000 Reputation Level)  Folding Points: 450581 Folding Title: Super Ultimate Folder - Level 1Folding Points: 450581 Folding Title: Super Ultimate Folder - Level 1Folding Points: 450581 Folding Title: Super Ultimate Folder - Level 1Folding Points: 450581 Folding Title: Super Ultimate Folder - Level 1Folding Points: 450581 Folding Title: Super Ultimate Folder - Level 1Folding Points: 450581 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 4 Weeks 10 h 48 m 38 sec
Reputation Power: 5273
Send a message via AIM to drumz0rz Send a message via Google Talk to drumz0rz
JavaScript - Script to denote if something's open or not

It might be over my head, but I want to make a script that will check the current date and time, then based off a pre-defined set of dates and times, it would display a simple "open" or "closed" message.

A real world example is a store is open 9-5 monday thru friday. So if you go to the page, it would tell you if the store is open or closed at the current time.


I know some basic javascript (i know java better) but I don't really know where to start.
__________________



Reply With Quote
  Trader Rating: 0 · #2  
Old February 17th, 2008, 10:36 AM
omrsafetyo's Avatar
omrsafetyo omrsafetyo is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Location: Maine, USA
Posts: 297 omrsafetyo User rank is Captain (20000 - 30000 Reputation Level)omrsafetyo User rank is Captain (20000 - 30000 Reputation Level)omrsafetyo User rank is Captain (20000 - 30000 Reputation Level)omrsafetyo User rank is Captain (20000 - 30000 Reputation Level)omrsafetyo User rank is Captain (20000 - 30000 Reputation Level)omrsafetyo User rank is Captain (20000 - 30000 Reputation Level)omrsafetyo User rank is Captain (20000 - 30000 Reputation Level)omrsafetyo User rank is Captain (20000 - 30000 Reputation Level)omrsafetyo User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Days 21 h 32 m 32 sec
Reputation Power: 221
Send a message via AIM to omrsafetyo
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.

Reply With Quote
Reply

Viewing: Dev Hardware ForumsSOFTWAREProgramming > JavaScript - Script to denote if something's open or not


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT