Thread: JavaScript
View Single Post
  #2 (permalink)  
Old April 4th, 2011, 09:24 AM
disel2010 disel2010 is offline
Authorized User
Points: 448, Level: 7
Points: 448, Level: 7 Points: 448, Level: 7 Points: 448, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts
Default

Hi,

I guess it's a probem with the order of the equal / greater than signs.

This works for me (equal sign behind the greater than sign):

Code:
<script type="text/JavaScript">

date = new Date();
time = date.getHours();

if (time < 12) {
document.write("Good Morning");
}
if (time < 18 && time >= 12) {
document.write("Good Afternoon");
}
if (time >= 18 && time < 24) {
document.write("Good Evening");
}
</script>
Reply With Quote
The Following User Says Thank You to disel2010 For This Useful Post:
crashbandicoot (April 5th, 2011)