469,353 Members | 2,221 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,353 developers. It's quick & easy.

automatically insert current year

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
Jul 20 '05 #1
4 20494
LJL
ze********@yahoo.com.au (Dave) wrote in
news:6e**************************@posting.google.c om:
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
Jul 20 '05 #2

"LJL" <no**@nowhere.com> wrote in message
news:Xn****************************@207.69.154.201 ...
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

Jul 20 '05 #3
Dave wrote:
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
Jul 20 '05 #4
Thank you to you all for the kind suggestions - they all work!

Dave

Erwin Moller <si******************************************@spam yourself.com> wrote in message news:<40*********************@news.xs4all.nl>...
Dave wrote:
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

Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Martin | last post: by
6 posts views Thread by Hasanain F. Esmail | last post: by
3 posts views Thread by Stephen V | last post: by
1 post views Thread by deejayquai | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.