View Single Post
  #1 (permalink)  
Old 01-01-2008, 11:37 AM
Martijn's Avatar   
Martijn Martijn is offline
Newbie
 
Join Date: Jan 2008
Posts: 2
Credits: 0
Rep Power: 0
Martijn is on a distinguished road
Default Javascript - Good Day Script

Hello, thanks for viewing. I'm trying to learn javascript and I was reading some tutorials.

right here

They showed an example of an script that shows "Good Morning, Or good day etc..." I didn't find it was quite perfect yet so I tried to edit it an little and ended up with this.

Code:
<script type="text/javascript">
var d = new Date();
var time = d.getHours();
if (time<10) 
{
document.write("Good morning!");
}
else if(time>10 && time<18)
{
document.write("Good Afternoon!");
}
else (time>18 && time<10)
{
document.write("Good Evening!");
</script>
It doesn't seem to work, and I don't know what the bug is. Can anyone help me?
I'm thinking I did something wrong with the "Time > 18 && time <10"
But I'm not sure.
__________________
Duck tape is like the force. It has a light side, a dark side, and it holds the world together.
Reply With Quote

Sponsored Links