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

Mark Rees mrees at itsagoodprice.com
Fri Nov 11 09:20:45 CST 2005

> 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

3. it uses the time on the client. Therefore if your client's clock is set
to 1984, your copyright line will read "2000-1984". I wonder what a lawyer
would make of that?

> 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.

Is SSI an option? Otherwise perhaps an annual search and replace in files
scheduled for January 1st? You could write a script to do this, or use a
suitable editor.

More information about the thelist mailing list