»
EnglishFrenchVietnamese

Print - STimit script - JavaScriptBank.com

Full version: jsB@nk » Time » Clock » STimit script
URL: https://www.javascriptbank.com/stimit-script.html

STimit script © JavaScriptBank.comA function to place a dynamic date - time banner any place on a web page. The function will also print messages, such as birthdays and reminders, based on the date. The function gives correct results regardless of DST differences and time of day.

Full version: jsB@nk » Time » Clock » STimit script
URL: https://www.javascriptbank.com/stimit-script.html



JavaScript
<script language="JavaScript"><!-- Another small but powerful function by Ira --><!-- Original Programmed by Ira Sterbakov - irasterb@erols.com 9/23/04 --><!-- May be freely used and modified - email notification would be nice --><!-- This application has been adjusted for the DST problem and will work through midnight-->// Set an Array for each event. Month (Jan is 1), date and then event. It doesn't have to be in date order.var rV1 = new Array(10,21,"Charlie's birthday");var rV2 = new Array(5,30,"Ira's Birthday");var rV3 = new Array(1,19,"Stan's Birthday");var rV4 = new Array(8,4,"Hugh's Birthday");// Set rDe to the number of rV arrays.var rDe = 4var hr = -1;var nD = -1function STimit(){var today = new Date();if ( hr != today.getHours()){if ( nD != today.getDate()){nFY = today.getFullYear();nM = today.getMonth();nD = today.getDate();todayA = new Date(nFY,nM,nD,4,0,0)endofyear = new Date(nFY-1, 11, 31,6,0,0);Tday = Math.ceil((todayA.getTime()-endofyear.getTime())/(1000*60*60*24));W1day = Tday;if( endofyear.getDay() <6) W1day += endofyear.getDay() + 1;Week = Math.ceil((W1day)/7);Mes2 = " ";for (ir = 1; ir <= rDe; ir++){eval("Rm = rV" + ir + "[0] - 1; Rd = rV" + ir +"[1]");if ( Rm == nM && Rd == nD) Mes2 = "<br>" + eval("rV" + ir + "[2]");}Mese = (" - Day " + Tday + " - Calendar Week " + Week + Mes2)}hr = today.getHours();gr = "Morning";if (hr >= 12) gr = "Afternoon";if (hr >= 18) gr = "Evening";Mesb = ("Good " + gr +" on<br>")}document.getElementById('Timit').innerHTML = (Mesb + today.toLocaleString() + Mese);setTimeout('STimit()',1000);}STimit();</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<div id="Timit" align="center">Good Evening on<br>Monday, November 08, 2004 21:03:40 - Day 313 - Calendar Week 46 </div><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->