That's close enough. The first thing to understand is that it's far, far better to do this server-side.
However, if you must do it client-side:
Code:
<script type="text/javascript">
var dates = new Array(), // Associative array
now = new Date(),
roughNow = Date.parse(now.getMonths() + "/" + now.getDays() + "/" + now.getFullYear());
dates[0] = "12/25/2004:xmas04";
dates[1] = "06/21/2005:litha05,tsanganniversary";
for(var i=0;dates[i];i++) {
var date = dates[i].substring(0, dates[i].indexOf(":")),
ids = dates[i].substring(":" + 1).split(",");
if(roughNow > Date.parse(date))
for(var j=0;j<ids.length;j++)
if(document.getElementById && document.getElementById(ids[j])) document.getElementById(ids[j]).style.display = "none";
}
</script>
That should work. The format for a date entry is mm/dd/yy:id1[, id2 [, ...]]
Bookmarks