<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Helvetica, sans-serif;
margin: 10px;
background-color: #D6CEBD;
color: #003F87;
}
.circleCanvas {
border: 3px solid #9AB3D5;
}
</style>
</head>
<body>
<h2>Scouts Build Web Technology</h2>
<h3>Fun With Time</h3>
<p id="thetime"><span id="timespan"></span></p>
<button type="button" onclick="getTime()">What Time Is It Now?</button>
<button type = "button" onclick = "displayHide()">Hide The Time</button>
<button type = "button" onclick = "displayShow()">Show The Time</button>
<script>
function getTime() {
document.getElementById("thetime").style.visibility = "visible";
document.getElementById("timespan").innerHTML = Date();
}
function displayHide() {
document.getElementById("thetime").style.visibility = "hidden";
}
function displayShow() {
document.getElementById("thetime").style.visibility = "visible";
}
</script>
<h3>Going in Circles</h3>
<canvas class="circleCanvas" width="400" height="200"></canvas><br />
<button class="Btn">Draw a Circle</button>
<script>
let canvasEle = document.querySelector(".circleCanvas");
let BtnEle = document.querySelector(".Btn");
BtnEle.addEventListener("click", () => {
var circle = canvasEle.getContext("2d");
circle.strokeStyle = '#CE1126'
circle.lineWidth = 5;
circle.beginPath();
// (x, y, radius, startAngle, endAngle)
circle.arc(180, 100, 90, 0, 2*Math.PI);
circle.stroke();
});
</script>
</body>
</html>