repl.it
HTML, CSS, JS

No description

fork
loading
Files
  • index.html
  • script.js
  • style.css
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
  <title>Time</title>
</head>
<center>
<p style="font-size:50px">Time is cool!</p>


<p style="font-size:23px">Time in England</p>

<body>
<div id="MyClockDisplay"></div>
<script type="text/javascript">
function showTime(){
  var date = new Date();
  var h = date.getHours();
  var m = date.getMinutes();
  var s = date.getSeconds();
  
  var time = h + ":" + m + ":" + s;
  document.GetElementById("MyClockDisplay").innerText = time;
  document.GetElementById("MyClockDisplay").textContent = time;
}

showTime();
setInterval(showTime, 1000);

</script>
</body>

</html>
result
console
?