JNorth
04-26-2010, 10:51 PM
Hello
Im trying to get my 'Good Morning', "Good Afternoon' and 'Good evening' statements right on a webpage but when the clock turns past 6 pm, both the Good afternoon and Good evening texts display instead of just 'Good evening' alone. What am I doing wrong? See below:
/* <![CDATA[ */
// write good morning, good afternoon or good evening
var clientDate;
var hrs; //hours
var mins;// minutes
clientDate=new Date;
hrs= clientDate.getHours(); // get the hours component of the systems date/time
mins=clientDate.getMinutes();
if (hrs >=18 && mins >=0 && hrs)
document.write (" Good Evening, Welcome to Windsurf!"); //Say Good Evening
if (hrs >=12 && mins >=0 && hrs )
document.write (" Good Afternoon, Welcome to Windsurf!" ); //say Good afternoon
else
document.write(" Good Morning, Welcome to Windsurf!"); //Say Good Morning
/* ]]> */
Im trying to get my 'Good Morning', "Good Afternoon' and 'Good evening' statements right on a webpage but when the clock turns past 6 pm, both the Good afternoon and Good evening texts display instead of just 'Good evening' alone. What am I doing wrong? See below:
/* <![CDATA[ */
// write good morning, good afternoon or good evening
var clientDate;
var hrs; //hours
var mins;// minutes
clientDate=new Date;
hrs= clientDate.getHours(); // get the hours component of the systems date/time
mins=clientDate.getMinutes();
if (hrs >=18 && mins >=0 && hrs)
document.write (" Good Evening, Welcome to Windsurf!"); //Say Good Evening
if (hrs >=12 && mins >=0 && hrs )
document.write (" Good Afternoon, Welcome to Windsurf!" ); //say Good afternoon
else
document.write(" Good Morning, Welcome to Windsurf!"); //Say Good Morning
/* ]]> */