/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
For full year (four digits): JS: today=new Date(); y0=today.getFullYear(); HTML: <p>© <script type="text/javascript">document.write(y0);</script> Somecompany, Inc. All Rights reserved.</p> - - - - - For partial year (last two digits): JS: var foo = (new Date().getFullYear()).toString(); // Contains last two characters of the full year. // ex: 2003 evaluates to 03. var bar = foo.substring(foo.length, 2); HTML: <p>All contents ™ and © 2005-<script type="text/javascript">document.write(bar);</script> Somecompany, Inc. unless otherwise noted herein. All rights reserved.</p>
Comments
