<script language="JavaScript">
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function countup(yr,m,d){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var paststring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1)
difference+=" días"
document.write("Este Sitio lleva "+difference+" en Internet desde su creación!")
}
//cambiar la fecha
countup(2009,05,01)
</script>
Cambiar fecha por la propia. (Año, mes, día.) y texto a mostrar.
Se puede personalizar.
Agregandole la etiqueta marquee:
<marquee>
<script language="JavaScript">
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function countup(yr,m,d){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var paststring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1)
difference+=" días"
document.write("Este Sitio lleva "+difference+" en Internet desde su creación!")
}
//cambiar la fecha
countup(2009,05,01)
</script>
</marquee>
Agregandole estilo CSS:
En este ejemplo lo centre, cambie color y tamaño del texto.
<div style="color: red; font-size: 20px; text-align: center;">
<script language="JavaScript">
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function countup(yr,m,d){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var paststring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1)
difference+=" días"
document.write("Este Sitio lleva "+difference+" en Internet desde su creación!")
}
//cambiar la fecha
countup(2009,05,01)
</script>
</div>
No hay comentarios:
Publicar un comentario