init
This commit is contained in:
14
html/tasks/chapter_2/clock/oppgave.html
Executable file
14
html/tasks/chapter_2/clock/oppgave.html
Executable file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="../../../../resources/css/main.css">
|
||||
<title>Clock</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Clock</h1>
|
||||
<p>The clock right now is: <span id="pointOfTime">Couldn't recieve data</span>.</p>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
15
html/tasks/chapter_2/clock/script.js
Executable file
15
html/tasks/chapter_2/clock/script.js
Executable file
@@ -0,0 +1,15 @@
|
||||
window.onload = updateTime;
|
||||
|
||||
function updateTime() {
|
||||
var time = new Date();
|
||||
var timeBox = document.getElementById("pointOfTime");
|
||||
var hours = time.getHours();
|
||||
var minutes = time.getMinutes();
|
||||
var seconds = time.getSeconds();
|
||||
|
||||
timeBox.innerHTML = hours+":"+minutes+":"+seconds;
|
||||
|
||||
/* setTimeout(updateTime, 1000); */
|
||||
}
|
||||
|
||||
setInterval(updateTime, 1000);
|
Reference in New Issue
Block a user