Module 2: JavaScript

Overview

This module gives students an opportunity to do some hands-on client-side scripting using JavaScript. Each lesson builds on previous lessons, and end in the end students will have created a functioning clock with buttons that enable users to toggle its display on and off. This can be challenging for some students, but much of the activities can be accomplished by copying and pasting code, then patiently troubleshooting if things don't work as expected.

Lesson 1: Using JavaScript to Show an Alert

Tips for Delivering This Lesson

Example Output

When this lesson is complete, students will have added an alert to javascript.html, plus a link that triggers the alert.

Lesson 2: Javascript Errors and Debugging

Answer Key For Buggy Examples

This lesson includes three buggy examples, and students are asked to identify the bugs. Here are the correct answers:

  1. Misspelled variable on line 4. The letter T in "mytext" needs to be capitalized.
  2. Unclosed character string on line 3. The closing quotation mark is missing.
  3. Spelling error on line 2. The word "function" is misspelled.

Lesson 3: Building a JavaScript Clock Part 1

Tips for Delivering This Lesson

Example Output

When this lesson is complete, students will have added a clock to javascript.html. It doesn't tick away the seconds yet—it simply displays the current time when the page loads. This clock will be improved in subsequent lessons.

Lesson 4: Building a JavaScript Clock Part 2

Tips for Delivering This Lesson

Example Output

When this lesson is complete, students will have used CSS to enhance their clock in javascript.html, plus added functionality to keep it ticking.

Lesson 5: Using Javascript to Hide and Show Content

Tips for Delivering This Lesson

Lesson 6: Building a Custom Video Player

Tips for Delivering This Lesson

Example Output

When this lesson is complete, students will have modified their video.html page so it now includes a custom video player.