.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Home >> Articles >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Articles

How to write automaitc/random year with the bottom section of a webpage.

Posted By:ASPEvil       Posted Date: July 24, 2014    Points: 200    Category: Javascript    URL: http://www.dotnetspark.com  

How to put automatic year update with a webpage's footer or with any other section of a webpage.

You made a website and delivered it to the client of yours. But with its footer section, you wrote something like: "copyright (c) 2014 <your client's organization>. All Rights Reserved". But on the next year, it is still showing the year as 2014 while it should be year 2015. How to resolve this issue where this year update will be done automatically, without your client contact you and you do the same? This articles shows how, as follow:-

Write down the following code at the bottom of the webpage where you are wanting to display that copyright text with the year:-

CopyRight © <script>document.write(new Date().getFullYear()) </script> <your client's organization>. All Rights Reserved.

With the above code:

<script>document.write(new Date().getFullYear()) </script>
, will display the current year and even you don't need to write the initial year on which you are making this website. So if you are making your website on the year: 2014, that part of the code will display the year 2014 when you just delivered the website to your client and on the next year, it will automatically show the year as: 2015 and on the next year it will show the year as: 2016 and so on, without your client's call to you to do the same.


 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend