By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
JRS: In article <Xn********************@212.83.64.216>, seen in
news:comp.lang.javascript, John Thermae <tr**@dsv.nl> posted at Tue, 18
Nov 2003 09:08:15 :-
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.


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: <Si**************@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.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.