html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="txt"></div>
<script>
console.log("2. scripts in body runs next.")
</script>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
body {
}
Enter to Rename, Shift+Enter to Preview
js
js
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
console.log("1. scripts in JS tab runs first");
window.onload = function(){
console.log("3. scripts in window.onload runs last.");
startTime();
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
let txtElem = document.getElementById('txt');
txtElem.innerHTML = h + ":" + m + ":" + s;
t = setTimeout(startTime, 500);
}
function checkTime(i) {
if (i < 10)
i = "0" + i;
return i;
}
}
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run