automatically insert current year

D

Dave

Hi,
Can anyone tell me a simple way of inserting some sort of code into a
Dreamweaver template (it goes at the bottom of the page in Copyright
info) that will cause the current year to be automatically inserted at
spot X when the pages are viewed that were produced from the template
or are linked to it?

Thanks
Dave
 
L

LJL

(e-mail address removed) (Dave) wrote in
Hi,
Can anyone tell me a simple way of inserting some sort of code into a
Dreamweaver template (it goes at the bottom of the page in Copyright
info) that will cause the current year to be automatically inserted at
spot X when the pages are viewed that were produced from the template
or are linked to it?

Thanks
Dave

In the HTML portion of the page write:


Copyright &copy; <SCRIPT>
<!--
var year=new Date();
year=year.getYear();
if (year<1900) year+=1900;
document.write(year);
//-->
</SCRIPT> Your Name, All Rights Reserved.



This will get the date, grab the year from the date, check to make sure it
is in 4-digit format (just in case) and insert it after a copyright "C" in
a circle and before your name. If put in as it is here, it should look
like this:

Copyright © 2004 Your Name, All Rights Reserved

Good luck, LJL
 
J

Janwillem Borleffs

LJL said:
In the HTML portion of the page write:


Copyright &copy; <SCRIPT>
<!--
var year=new Date();
year=year.getYear();
if (year<1900) year+=1900;
document.write(year);
//-->
</SCRIPT> Your Name, All Rights Reserved.

Why not just:

Copyright &copy; <script type="text/javascript">
document.write(new Date().getFullYear());
</script> Your Name, All Rights Reserved.

?


JW
 
E

Erwin Moller

Dave said:
Hi,
Can anyone tell me a simple way of inserting some sort of code into a
Dreamweaver template (it goes at the bottom of the page in Copyright
info) that will cause the current year to be automatically inserted at
spot X when the pages are viewed that were produced from the template
or are linked to it?

Thanks
Dave

Hi Dave,

Without any knowlegde of Dreamweaver whatsoever, try this:

current year:
<script type="text/javascript">
D = new Date();
year = D.getFullYear();
document.write(year);
</script>

It produces the year as set on the clientmachine.

Regards,
Erwin Moller
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top