| |
PROGRAMMING COURSES
ADMIN VIDEO TUTORIALS
COMMUNITY RESOURCES
|
|
|
Dynamic Copyright Year Display for Any Website Or Application |
Programming Category: Javascript
Author: Adam Added: Oct 28, 2009 Views: 964 |
 |
Many applications made today must render information to the pages dynamically due to the software creator not knowing certain specifics that are universal variables. Certain things can be made dynamic to where the software author can set the dynamic scripts and have the correct information display no matter what the variable value may be.
In this little Javascript tutorial I will show you how to render the copyright year date dynamically so it never has to be touched again no matter what year it is. I also do a similar thing using PHP, I like using PHP better for this but since Javascript can do it too I thought it only fair to show it.
FIrst this code goes in the "head" tag of your web document: <script language="javascript" type="text/javascript"> var dateObject=new Date(); </script>
Then this code goes exactly where you want it to display output to the browser page: <script type="text/javascript"> document.write(dateObject.getFullYear()); </script>
Making your complete document resemble something like this: <html> <head> <script language="javascript" type="text/javascript"> var dateObject=new Date(); </script> </head> <body> © <script type="text/javascript"> document.write(dateObject.getFullYear()); </script> DevelopPHP.com </body> </html>
|
|
|