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.