Need help in programming use HTML/Javascript!!!

Status
Not open for further replies.

thomgun_lc

Member level 5
Joined
Jun 29, 2004
Messages
80
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
911
Hi, there i need a help about how to show the greetings such as "good morning" when we access the site at 7-12am, and good evening at 6-10pm??Need ur help??I need the source code, can anyone help me???
 

there are several options you can decide on:
- if the time is fixed onto server time -> server side programming (php, perl, asp, etc.)
- if the time is according to the user local time -> you can use client side (java script).
 

try the following

<!--
now = new Date

if (now.getHours() < 7) {
document.write("Good Evening!")
}
else if (now.getHours() < 12) {
document.write("Good morning!")
}
else if (now.getHours() < 18) {
document.write("Good Afternoon!")
}
else {
document.write("Good Evening!")
}
//-->
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…