Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- window.onload = timer();
- function exibirData() {
- var tempo = new Date();
- var horas = tempo.getHours();
- var minutos = tempo.getMinutes();
- var segundos = tempo.getSeconds();
- if(horas < 10)
- horas = "0" + horas;
- if(minutos < 10)
- minutos = "0" + minutos;
- if(segundos < 10)
- segundos = "0" + segundos;
- var mostrar = horas + ":" + minutos + ":" + segundos;
- document.getElementById("exibir").innerHTML = mostrar;
- }
- function timer() {
- setInterval(exibirData, 1000);
- }
- </script>
- </head>
- <body>
- <span id = "exibir"></span>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement