2 Replies - 11278 Views - Last Post: 29 August 2001 - 10:45 AM

#1 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1877
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Assignment #2 - Display message based on time of day

Posted 29 August 2001 - 08:41 AM

The scenario for this was to take a pre-done page and put some script in to show a message based on the time of day... Keep in mind the hours are based on 24, not like 8:00PM...Here is the JS script:
<SCRIPT LANGUAGE="Javascript">
today = new Date()
  if ((today.getHours() >=4) && (today.getHours() <=12)){
    document.write("Good Morning. Have a rush job for the afternoon? We can handle it!")
  }
  if ((today.getHours() >12) && (today.getHours() <=18)){
    document.write("Good afternoon. We can get that print job ready by tomorrow morning.")
  }
  if ((today.getHours() >18) && (today.getHours() <=23)){
    document.write("Good evening. We will be here all night if you need us!")
  }
  if ((today.getHours() >=0) && (today.getHours() <4)){
    document.write("Yes, we are working at this hour!")
  }

</SCRIPT>

Here is the actual page: http://w3.tvi.cc.nm....kyhawk/cp132/j2


Is This A Good Question/Topic? 0
  • +

Replies To: Assignment #2 - Display message based on time of day

#2 codeman  Icon User is offline

  • w3c fanatic

Reputation: 3
  • View blog
  • Posts: 1,190
  • Joined: 13-August 01

Re: Assignment #2 - Display message based on time of day

Posted 29 August 2001 - 09:37 AM

uh....I don't see the script on the page.  I'm using IE 5.5 so is it for Netscape or something? :)
Was This Post Helpful? 0
  • +
  • -

#3 LeprechauN  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 2
  • View blog
  • Posts: 857
  • Joined: 12-March 01

Re: Assignment #2 - Display message based on time of day

Posted 29 August 2001 - 10:45 AM

"Welcome to Carbon Copy Printers. Good afternoon. We can get that print job ready by tomorrow morning. We are open 24 hours a day. No job is too big or too small."

It returns the message acording to your current time.

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1