Calendars Effects >>> Daily Greeting.
 
Script Categories













Calendars >>> Daily Greeting.

Display the date on a small calender together with an appropriate salutation based on the time of the day.


Add the below code to the <body> section of your page:

<p align="center">
<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
var Today=new Date();
var ThisDay=Today.getDay();
var ThisDate=Today.getDate();
var ThisMonth=Today.getMonth()+1;
var ThisYear=Today.getFullYear();  //included if you wish to insert the year
function DayTxt (DayNumber) {
var Day=new Array();
Day[0]="Sunday";
Day[1]="Monday";
Day[2]="Tuesday";
Day[3]="Wednesday";
Day[4]="Thursday";
Day[5]="Friday";
Day[6]="Saturday";
return Day[DayNumber];
}
var DayName=DayTxt(ThisDay);
function MonthTxt (MonthNumber) {
var Month=new Array();
Month[1]="January";
Month[2]="February";
Month[3]="March";
Month[4]="April";
Month[5]="May";
Month[6]="June";
Month[7]="July";
Month[8]="August";
Month[9]="September";
Month[10]="October";
Month[11]="November";
Month[12]="December";
return Month[MonthNumber];
}
var MonthName=MonthTxt(ThisMonth);
var d = new Date();
var h = d.getHours();
//document.write("<TABLE BORDER=3 BGCOLOR=WHITE  WIDTH=75 HEIGHT=85 align=left>"+"<TR><TD>"+"<p align=center>"+"<font size=-2 >"+DayName+"<br>"+"<font color=orangered size=+3 >"+ThisDate+"</font>"+"<br>"+MonthName+"<br>"+"</b>"+"</font>"+"</p>"+"</TD>"+"</TR>"+"</TABLE>");
document.write("<table BORDER=3 BGCOLOR=WHITE  WIDTH=75 HEIGHT=85 align=left><tr><td>"+"<center><b><font size=-2 >"+DayName+"</font><br><font color=orangered size=+3 >"+ThisDate+"</font><br><font size=-2 >"+MonthName+"</font></b></center></td></tr></table><br>");
if (h < 2) document.write("<P ALIGN=center>"+"<b>"+"Good morning! Yes, it's way past midnight."+"</b>"+"</P>");
else if (h < 3) document.write("<P ALIGN=center>"+"<b>"+"Good morning! Up early or working late?"+"</b>"+"</P>");
else if (h < 7) document.write("<P ALIGN=center>"+"<b>"+"Good morning! Up bright and early!"+"</b>"+"</P>");
else if (h < 12) document.write("<P ALIGN=center>"+"<b>"+"Good morning!"+"</b>"+"</P>");
else if (h < 17) document.write("<P ALIGN=center>"+"<b>"+"Good afternoon!"+"</b>"+"</P>");
else if (h < 23) document.write("<P ALIGN=center>"+"<b>"+"Good evening!"+"</b>"+"</P>");
else document.write("<P ALIGN=center>"+"<b>"+"A late good evening! Not much left of it now."+"</b>"+"</P>");
//  End -->
</script>
</p><br>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©