icon picker
Project 3: HTML/CSS/Javascript

Intro

HTML is a language made up of elements, which can be applied to pieces of text to give them different meaning in a document
CSS is used to style [your content] and lay it out.
JavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language [that is] most well-known as the scripting language for Web pages.

Setup

Copy/paste this text into the left side of the screen and click “Run”:
<!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>

Your Turn

Make the following changes:
Change the colors of the page (background-color and color).
Add text that says “The time is: “ in front of the time that’s displayed.
Change the lineWidth and strokeStyle of the circle.
Change several different parameters of the call to circle.arc(...), see what happens.
ok
You may find to be helpful in working on this.

More Info

For more info about HTML/CSS/JavaScript visit:

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.