codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Pagina senza titolo</title>
<script language="javascript" type="text/javascript">
// <!CDATA[
function Button1_onclick()
{
var di = new Date(2007, 6, 5);
var df = new Date(2007, 7, 5);
var s = "";
while(df >= di)
{
s += di.toStringDate() + "
";
di.AddDays(1);
}
document.getElementById("div1").innerHTML = s;
}
// aggiunta di AddDays a Date
Date.prototype.AddDays = function (days)
{
this.setTime( this.getTime() + days * 86400000 );
};
Date.prototype.AddHours = function (hours)
{
this.setTime( this.getTime() + hours * 3600000 );
};
Date.prototype.toStringDate = function ()
{
var g = this.getDate(); g = (g < 10)? '0' + g: g;
var m = (this.getMonth() + 1); m = (m < 10)? '0' + m: m;
var a = this.getFullYear();
return g + "/" + m + "/" + a;
};
// ]]>
</script>
</head>
<body>
<input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
<div id="div1"></div>
</body>
</html>