IT Community - Software Programming, Web Development and Technical Support

How do I show a customized message based on the time of day?

This is a discussion on How do I show a customized message based on the time of day? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi all... How do I show a customized message based on the time of day? Thanks......


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-18-2007, 05:34 AM
itbarota itbarota is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 547
itbarota is on a distinguished road
Default How do I show a customized message based on the time of day?

Hi all...

How do I show a customized message based on the time of day?

Thanks...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-18-2007, 05:39 AM
sathian sathian is offline
D-Web Analyst
 
Join Date: Aug 2007
Posts: 252
sathian is on a distinguished road
Default Re: How do I show a customized message based on the time of day?

Hi,

Use following script,

<script language="JavaScript"><!--
var date = new Date();
var hours = date.getHours();
if ( (hours < 6) || (hours >= 22) )
document.write("Good Night")
else if ( (hours >= 19) && (hours < 22) )
document.write("Good Evening")
else if ( (hours >= 6) && (hours < 9) )
document.write("Good Morning")
else
document.write("Good Day");
//--></script>

Thanks
Sathian.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-18-2007, 05:50 AM
Pvinothkumar Pvinothkumar is offline
D-Web Analyst
 
Join Date: Sep 2007
Posts: 237
Pvinothkumar is on a distinguished road
Default Re: How do I show a customized message based on the time of day?

Hi all...

<script language="JavaScript">

var date = new Date();
var hours = date.getHours();

if ( (hours > 11)
document.write("Good Afternoon")

else if ( (hours > 17)
document.write("Good Evening")

else
document.write("does not have");
</script>

Thanks...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
show clocks, one showing the current time, and another showing a time 12 hours behind itbarota HTML, CSS and Javascript Coding Techniques 1 02-13-2008 10:15 PM
Product-based Company and Projects-based Company : vigneshgets Software Testing 0 01-15-2008 11:03 PM
Why do I get Error message "Unable to Start Debugging" Error Message? a.deeban ASP and ASP.NET Programming 5 09-25-2007 12:22 AM
How can I set the time zone for MySQL to UK time? itbarota PHP Programming 1 09-12-2007 01:13 AM
Diff between Transaction-time and Server response-time vadivelanvaidyanathan Software Testing 0 03-21-2007 07:29 AM


All times are GMT -7. The time now is 11:29 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0