Modificando el codigo adecuadamente podeis personalizar el metodo countdown para que os devuelva en la celda lo que querais: fotos, una TABLE, una frase, etc.
<html>
<script>
var texto=""
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var dias=new Array()
dias[0]=new Array(2011,6,25,"Cumple Nikolai","fuchsia")
dias[2]=new Array(2011,6,26,"Cto. Espana Veteranos","yellow")
dias[3]=new Array(2011,7,2,"Cto. Suiza 10000. Tesserette","yellow")
dias[5]=new Array(2011,7,16,"Vaxjo, 10 kms.","yellow")
dias[6]=new Array(2011,7,23,"Cto. Andalucia Abs.","lime")
dias[1]=new Array(2011,8,25,"Cumple Mama","fuchsia")
dias[4]=new Array(2011,8,27,"Cto. Mundo Policia NY","yellow")
function tabla()
{
var hoy=new Date()
var hoy2=new Date()
var hoyD=hoy.getDay()
hoy2.setDate(hoy2.getDate()-hoyD)
for (a=0;a<20;a++)
{
document.write("<tr>")
for(b=0;b<7;b++)
{
hoy2.setDate(hoy2.getDate()+1)
ponerCelda(hoy2.getYear(),hoy2.getMonth()+1,hoy2.getDate())
}
document.write("</tr>")
}
}
function ponerCelda(yr,m,d)
{
if (yr<1000)
yr+=1900
countdown(yr,m,d,"","cyan")
for (c=0;c<dias.length;c++)
{
if (yr==dias[c][0] & m==dias[c][1] & d==dias[c][2])
countdown(dias[c][0],dias[c][1],dias[c][2],dias[c][3],dias[c][4])
}
document.write(texto)
}
function countdown(yr,m,d,hecho,color)
{
var today=new Date()
var todayy=today.getYear()
if (hecho!="") hecho=hecho+"<br>"
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var futurestring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
if (difference==0)
texto="<td bgcolor=red>"+hecho+d+"-"+m+"-"+yr+"<br>"+difference+"</td>"
else if (difference>0)
texto="<td bgcolor="+color+">"+hecho+d+"-"+m+"-"+yr+"<br>"+difference+"</td>"
else if (difference<0)
texto="<td></td>"
}
</script>
<body bgcolor=blue>
<table>
<tr><td><table><tr><td><img src="file:\c:fotosvancouver1.jpg" height=600></td></tr></table></td><td>
<table border=1>
<tr><td bgcolor="white">L</td><td bgcolor="white">M</td><td bgcolor="white">X</td><td bgcolor="white">J</td><td
bgcolor="white">V</td><td bgcolor="white">S</td><td bgcolor="white">D</td></tr>
<script>tabla()</script>
</td></tr></table>
</body>
</html>
No hay comentarios:
Publicar un comentario