[thelist] Automatically updating copyright date in JavaScript - fallback?

Tom Dell'Aringa pixelmech at yahoo.com
Fri Nov 11 09:13:40 CST 2005


Hey there,

I've been using a kind of kludgy way to keep from updating our many pages with copyright dates
every year with a new year (2005-2006 for example). Here tis:

Copyright 2000-<span id="cdate"></span> Company name, etc etc.

<script type="text/javascript">
// <![CDATA[
var now = new Date()
document.getElementById("cdate").innerHTML = now.getFullYear();
// ]]>
</script>

This is problematic for a couple reasons:

1. JS inline code
2. Fails (no date) if JS turned off

We're not using a server side script for this because in some instances these are flat HTML files,
so the server side solution would only work for most, but not all pages.

Any suggestions? Possibly a way to use CSS :content? This is low on the radar with people here,
but I'd like a better solution.

Tom



http://www.pixelmech.com/
"I was in a convenience store reading a magazine and the clerk came up to me and said "This is not a library". so I said, "All right, I will talk louder then!"



More information about the thelist mailing list