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

Matt Warden mwarden at gmail.com
Fri Nov 11 09:27:07 CST 2005


On 11/11/05, Tom Dell'Aringa <pixelmech at yahoo.com> wrote:
> 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>

Why not just put the word 'Present' in the span by default? So, non-JS
users will get "Copyright 2000-Present', JS users will get "Copyright
2000-$currentYear". Or, if you don't like that, move the 2000 into the
span, and have "Copyright <span>since 2000</span>" for non-JS,
"Copyright <span>2000-$currentYear</span>" for JS users.

Matt Warden
Miami University
Oxford, OH, USA

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list