Connecting Tech Pros Worldwide Forums | Help | Site Map

I'm looking for a oneline text "event calender"

John Thermae
Guest
 
Posts: n/a
#1: Jul 20 '05
I want to have a javascript that places a greeting depending on the date
for example ; from Dec.20 till Dec.24 it will say "have a nice holiday"
and Dec. 25 and 26th it says "Merry Christmas" and Dec 31
"be careful full whit fireworks" ect. ect.

ps. it don't have to display a date,
I already have a script that displays the date


Who can help me with this

Dr John Stockton
Guest
 
Posts: n/a
#2: Jul 20 '05

re: I'm looking for a oneline text "event calender"


JRS: In article <Xns945A672ABB500johntm@212.83.64.216>, seen in
news:comp.lang.javascript, John Thermae <trip@dsv.nl> posted at Tue, 18
Nov 2003 09:08:15 :-[color=blue]
>I want to have a javascript that places a greeting depending on the date
>for example ; from Dec.20 till Dec.24 it will say "have a nice holiday"
>and Dec. 25 and 26th it says "Merry Christmas" and Dec 31
>"be careful full whit fireworks" ect. ect.[/color]

I hope that you are writing it in Dutch, or that you get the spelling
independently checked.

In what way did the FAQ - see in references below - prove inadequate?

with (new Date()) PsoD = (getMonth()+1)*100 + getDate()

document.writeln(
PsoD>=1220 && PsoD<1225 ? "hanh" :
PsoD==1225 || PsoD==1226 ? "MC" :
PsoD==1231 ? "bcfwf" : "normal day"
)


For a longer list, note that the problem is similar to that solved in
Subject: Re: HELP - "On This Day" javascript code
Date: Mon, 10 Nov 2003 13:56:06 +0000
Message-ID: <SisYUFI2j5r$EwtL@merlyn.demon.co.uk>
provided that the individual events do not span many days (then, that
form of data storage would be inefficient)

var List = {
D0704: 1,
D0705: 1,
D0423: 2 }

today = "D0423"

if (T=List[today]) alert(S[T])

where T is an array of legends in which entry zero is dummy("").

For large spans, noting that it may be useful to get an empty string
returned on a non-special day, use a data structure like

List = [
[1220, 'hanh'],
[1225, 'MC'],
[1227, ''],
[1231, 'bcfwf'] ]
and scan it to find the last entry for which the number has been
reached.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Closed Thread