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

Christian Heilmann codepo8 at gmail.com
Fri Nov 11 09:20:47 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.

You could set your server to parse .html as .shtml and use SSI
instead? Is it really necessary to renew the copyright statement, or
isn't it just *starting* from that year?

More information about the thelist mailing list