<!--ALERT BOX CALENDAR/CLOCK--> <!-- This whole script goes in the HEAD the html file --> <script language="JavaScript" type="text/javascript"> <!-- Copyright 2002, Sandeep Gangadharan --> <!-- For more free scripts go to http://sivamdesign.com/scripts/ --> <!-- var month = new Array(); month[0]="January"; month[1]="February"; month[2]="March"; month[3]="April"; month[4]="May"; month[5]="June"; month[6]="July"; month[7]="August"; month[8]="September"; month[9]="October"; month[10]="November"; month[11]="December"; 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"; today = new Date(); date = today.getDate(); day = (day[today.getDay()]); month = (month[today.getMonth()]); year = today.getFullYear(); suffix = (date==1 || date==21 || date==31) ? "st" : "th" && (date==2 || date==22) ? "nd" : "th" && (date==3 || date==23) ? "rd" : "th" dateStr=day + ", " + date + suffix + " " + month + ", " + year; function sivamtime() { now=new Date(); hour=now.getHours(); min=now.getMinutes(); if (min<=9) { min="0"+min; } if (hour>12) { hour=hour-12; add=" p.m."; } else { hour=hour; add=" a.m."; } if (hour==12) { add=" p.m."; } if (hour==00) { hour="12"; } timeStr = ((hour<=9) ? "0"+hour : hour) + ":" + min + ":" + add; window.alert('The Date is: ' + dateStr + '\n' + 'The Time is: ' + timeStr); return true; setTimeout("sivamtime()", 1000); } // --> </script> <!-- This goes in the BODY the html file --> <form> <input type="button" value="Get Date & Time" onClick="sivamtime()" /> </form>