Ver la Fecha actualizada en ventana emergente.
Esta vez hemos escrito todo el código javascript en la misma página:
<!DOCTYPE html> <html lang = "es-ES"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="estilo.css"> <title>Fecha Actualizada</title> </head> <body> <script> let f=new Date(); let meses = new Array ("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"); document.write('<div class="mifecha">'); document.write('<div class="ano">' + f.getFullYear() + '</div>'); document.write('<div class="dia">' + f.getDate() + '</div>'); document.write('<div class="mes">' + meses[f.getMonth()] + '</div>'); document.write('</div>'); </script> </body> </html> |
Y este es el código de la hoja de estilos vinculada:
html{ background-color: #fff; } .mifecha { background-color: #999; padding: 3px; width: 110px; text-align: center; font-family:verdana, arial; font-size: 12pt; } .mifecha .ano{ background-color: #c0392b; padding: 2px; font-size: 100%; margin-bottom: 3px; color: #fff; letter-spacing: 3px; font-weight: bold; } .mifecha .dia{ background-color: #e5968e; font-size: 300%; padding: 5px 8px; margin-bottom: 3px; font-weight: bold; color: #154360; } .mifecha .mes{ background-color: #c0392b; font-size: 80%; padding: 2px; color: #fff; font-weight: bold; } |
Obtenido aquí: https://desarrolloweb.com/articulos/mostrar-fecha-actual-javascript.html
No hay comentarios:
Publicar un comentario