Estou seguindo exemplos de um livro e tô tendo problemas com um deles. No console não dá erro nenhum, mas o out não aparece na div1.
Essa sintaxe out += … + está correta? Sabem me dizer pq não está aparecendo o output do script?
Será que é pq a div tá embaixo do botao?
<!DOCTYPE html>
<html>
<head>
<title>Testes</title>
<script>
function telltime(){
var out = "";
var now = new Date();
out += "<br>Date: " + now.getDate();
out += "<br>Month: " + now.getMonth();
out += "<br>Year: " + now.getFullYear();
out += "<br>Hours: " + now.getHours();
out += "<br>Minutes: " + now.getMinutes();
out += "<br>Seconds: " + now.getSeconds();
document.getElementById("div1").innertHTML = out;
}
</script>
</head>
<body>
<p>The Current Date and Time are:</p><br>
<div id="div1"></div>
<script>
telltime();
</script>
<input type="button" onclick="location.reload()" value="Refresh" />
</body>
</html>