Chapter 15 - Activity of the Day - Start
The starting point for the project from Chapter 15 of JavaScript for Kids For Dummies by Chris Minnick and Eva Holland
by totoromaum
HTML
<h1>JS Activity of the Day</h1>
Today Is:
<div id="todaysdate"></div>
<div id="buttonBox">
<button id="whattodo" type="button">What should I do today?</button>
</div>
<div id="thingToDo"></div>
CSS
body {
font-family: "Comic Sans MS";
}
#buttonBox {
margin-top: 30px;
}
#thingToDo {
margin-top: 20px;
background-color: #dadada;
}
JavaScript
var todayDate = document.getElementById("todaysdate");
var todoButton = document.getElementById("whattodo");
// add a listener to the whattodo button
todoButton.addEventListener("click", displayActivity);
// create a new Date object
var d = new Date();
// call the displayDate() function
displayDate();
function displayDate() {
// todo: display the current date in the todaysdate div
}
function displayActivity() {
// todo: find out the day of the week.
/* todo: set a variable, called youShould, with a different
string based on what day of the week it is. */
// todo: output the value of youShould into the thingToDo div
}