[personal profile] tamaranth
Ok, so imagine that I have an HTML image map and I want to have the links clickable only on or after certain dates. (Yep: Advent calendar!) Is there a nice quick easy Javascript way of doing this? My google-fu and /or my brain are not asking the right questions. And I am running out of coding time ...

(Logic basically: IF TODAY > X THEN LINK = Something Useful ELSE LINK = Stay Put)

Edit: I know how to use the date functions in Javascript and I know how to check the current date against a number. What I don't know is how to make the link dependent on the result.

Further edit: no more LJ til late this evening ...

Date: Tuesday, December 1st, 2009 08:05 am (UTC)
From: [identity profile] ramtops.livejournal.com
You mean can you do it in Javascript, not Java. Possibly, but I'd always do it server side (i.e. PHP or some such). Google for javascript date functions

Date: Tuesday, December 1st, 2009 08:15 am (UTC)
From: [identity profile] tamaranth.livejournal.com
sorry, was posting in a hurry: corrected.

as per edit, I know how to use the date functions to check whether today is >= a certain number: I just can't work out how to integrate that check with image map code.

And now I'm effectively offline til late evening :(

Date: Tuesday, December 1st, 2009 08:40 am (UTC)
From: [identity profile] the-magician.livejournal.com
There is existing code for this out on the web!

http://java-programming.suite101.com/article.cfm/how_to_create_an_advent_calendar_with_javascript

http://www.sean.co.uk/a/webdesign/javascript_advent_calendar/index.shtm
(the date checking is commented out/off so you need to remove the // where marked)

Google: "javascript advent calendar"
Edited Date: Tuesday, December 1st, 2009 08:44 am (UTC)

Date: Tuesday, December 1st, 2009 08:51 am (UTC)
From: (Anonymous)
no, that code just checks date and displays or doesn't display images. I need to integrate the check with the actual image map (so that it has one link if the date is 'okay' and another if it doesn't).

But I am clearly not explaining the question properly.

Date: Tuesday, December 1st, 2009 11:02 am (UTC)
From: [identity profile] woolymonkey.livejournal.com
imagine that I have an HTML image map
Monkey imagination failure error.

July 2025

S M T W T F S
   1 234 5
6 7 8 9101112
13 14 15 16 17 1819
20 21 22 2324 2526
27 28 293031  

Most Popular Tags

Expand Cut Tags

No cut tags