Develop PHP Website for Learning Web Design Free Online
  Home   |   Forums   |   DevCMS
  Join   |   Log In
 
 


Tutor at Develop PHP
Dynamic Copyright Year Display for Any Website Or Application
Programming Category: Javascript

Author: Adam      Added: Oct 28, 2009      Views: 964    
Tweet This Page  Post page to Facebook  Post page to Facebook

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>
&copy;
<script type="text/javascript">
document.write(dateObject.getFullYear());
</script>
DevelopPHP.com
</body>
</html>


Comment on Dynamic Copyright Year Display for Any Website Or Application

 
 
Arbitrary Links and Archives
Home
Active Forums
Members
SIte News
Link To Us
Gear
2009 Forum Archive
Programming Courses
Learn HTML
Learn CSS
Learn PHP
Learn MySQL
Learn Javascript
Learn jQuery
Learn ActionScript 3.0
Learn Java
Learn XML
DevelopPHP Requires Flash Player
Get Adobe Flash player
___________________________________________

Terms of Use  •  Privacy  •  Admin Notes

©2010 developphp.com   |   Powered By FlashBuildingHolder