HTML-Kodu:
<!-- Paste this code into an external JavaScript file -->
/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Robin Jones :: http://www.robinjones1.freeuk.com/ */
function daysTill() {
//---------- EDIT THE VARIABLES BELOW ------------------
// EDIT THE VARIABLES BELOW
var day= 1 // Day
var month= 1 // Month
var year= 2009 //Year
var event= "New Year's Day 2009"
var end = "days left until"
//---------- END OF EDIT -------------------------------
var daystocount=new Date(year, month -1, day)
today=new Date()
if (today.getMonth()==month && today.getDate()>day)
daystocount.setFullYear(daystocount.getFullYear())
var oneday=1000*60*60*24
var write = (Math.ceil((daystocount.getTime()-today.getTime())/(oneday)))
document.write('There are <strong>'+write +'</strong> '+end+' '+event)
}
<!-- Paste this code into the HEAD section of your HTML document
Change the file name and path to match the one you created --> <script type="text/javascript" src="yourFileName.js"></script> <!-- Paste this code into the BODY section of your HTML document --> <script type="text/javascript"> <!--
daysTill();
//--> </script> <p><div align="center"> <font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font> </div><p>