Click to See Complete Forum and Search --> : JS for Yearly Copyright Update Problem!


luckysigns
07-18-2004, 10:27 PM
Hello:

I have been able to use the following copyright update JS successfully on many pages:

<script language="JavaScript">
copyright=new Date();
update=copyright.getYear();
document.write("© 1999-"+ update + " TagXpress, Paw Print ID's, Paw Pals, DogTagsAmerica, LuckySigns, All Rights Reserved.");
</script>

For example it works at the following:
http://www.tagxpress.com/disktest.htm

HOWEVER, I CANNOT get it to work on this page:
http://www.tagxpress.com/diskstest2.htm

After adding the script in my HTML editor I get the following error:

"Object Doesn't support this property or method"

Where could the problem be? Really want to integrate this great feature to all my sites/pages?

Thanks in advance for any help, LS

fredmv
07-18-2004, 10:33 PM
Make a file called copyright.js containing only:document.write('Copyright &amp;copy; 1999-' + (new Date()).getFullYear() + '. All rights reserved.');Then include where you want via:<script type="text/javascript" src="copyright.js"></script>Ideally though, you'd use server-side. This would be much more accessible. Simple PHP:<?php echo 'Copyright &amp;copy; 1999-' . date('Y') . '. All rights reserved.'; ?>

luckysigns
07-18-2004, 10:53 PM
Hi

Got the one using a .js text file to work. For the .php version, must I have a separate .php file within the root directory on the server to make it work? Or do I simply need the .php bit you showed within the .html of each page that would show the copyright etc? I know this is exceedingly basic, but I make no secret of being a novice...

Thanks for your help, LS

fredmv
07-18-2004, 10:55 PM
It's fine. Personally, I'd just make a copyright.php, and then you could include it just like you would the JavaScript, except you'd use:<?php include('copyright.php'); ?>It would just make your entire site a lot easier to update.