Docsity

Lesson 1.3: Using the DOM, Lecture notes of Javascript programming

Toggle sidebar
bg1
Lesson 1.3: Using the DOM
Course: Web Development | Module: Introduction to Javascript in HTML
https://codehs.com/course/7968/lesson/1.3
Description
In this lesson, students learn how to modify HTML tags on a webpage
using the DOM. The DOM, or Document Object Model, translates HTML
files into accessible objects that can be manipulated or added to a
webpage.
Objective
Students will be able to:
Modify existing elements on a web page using
document.getElementById
Modify existing elements on a web page using
document.getElemenyByTagName
Explain the purpose of the DOM, and how it is used to manipulate
HTML files
Activities
1.3.1 Video: getElementById
1.3.2 Check for Understanding: getElementById Quiz
1.3.3 Example: Welcome to My Site!
1.3.4 Exercise: Let's Get to Know You
1.3.5 Exercise: Simple Math
1.3.6 Video: Using the DOM
1.3.7 Check for Understanding: Using the DOM Quiz
1.3.8 Example: Multiple p tags
1.3.9 Exercise: Menu Opinion
1.3.10 Exercise: Longest Paragraph
Prior Knowledge
Script tags
Lists
Iteration
The console
Planning Notes
This is a longer lesson. It can be split into two at the video Using
the DOM.
This lesson includes a handout. Consider using this during class, or
assigning it as homework.
This lesson involves accessing items in a list. If students are
unfamiliar with this topic or could use additional practice, be sure to
pf3

Partial preview of the text

Download Lesson 1.3: Using the DOM and more Lecture notes Javascript programming in PDF only on Docsity!

Lesson 1.3: Using the DOM

Course: Web Development | Module: Introduction to Javascript in HTML https://codehs.com/course/7968/lesson/1. Description In this lesson, students learn how to modify HTML tags on a webpage using the DOM. The DOM, or Document Object Model, translates HTML files into accessible objects that can be manipulated or added to a webpage. Objective Students will be able to: Modify existing elements on a web page using document.getElementById Modify existing elements on a web page using document.getElemenyByTagName Explain the purpose of the DOM, and how it is used to manipulate HTML files Activities 1.3.1 Video: getElementById 1.3.2 Check for Understanding: getElementById Quiz 1.3.3 Example: Welcome to My Site! 1.3.4 Exercise: Let's Get to Know You 1.3.5 Exercise: Simple Math 1.3.6 Video: Using the DOM 1.3.7 Check for Understanding: Using the DOM Quiz 1.3.8 Example: Multiple p tags 1.3.9 Exercise: Menu Opinion 1.3.10 Exercise: Longest Paragraph Prior Knowledge Script tags Lists Iteration The console Planning Notes This is a longer lesson. It can be split into two at the video Using the DOM. This lesson includes a handout. Consider using this during class, or assigning it as homework. This lesson involves accessing items in a list. If students are unfamiliar with this topic or could use additional practice, be sure to

review Intro to Arrays in the JavaScript Bootcamp module. Standards Addressed Teaching and Learning Strategies Lesson Opener: Have students answer the beginning of class discussion questions (5- 7 mins). Consider pulling up a completed version of the Welcome to My Site example, and ask if students would be able to complete that with the knowledge that they currently have. Explain to them that in this lesson, they are going to learn how they can manipulate elements on a webpage using JavaScript. Activities: Watch getElementById and complete the corresponding quiz. (6 - 8 mins) Explore Welcome to My Site!. (3 mins) Have students open the console and try typing document.getElementById directly into the console. They should see that it actually returns the element object. Complete Let’s Get to Know You and Simple Math (10 - 12 mins). Watch Using the DOM and complete the corresponding quiz. ( mins) Consider splitting this lesson into two by showing this during the next class period. Consider using the Practice with the DOM handout before moving on to the next video. If students are not familiar with lists, use the rest of class to go over or cover lists instead of moving on to this material. Explore Multiple p tags (3 mins). Make sure that students open the console to see how the elements are being manipulated. Complete Menu Opinion and Longest Paragraph (10- 12 mins) Longest Paragraph is completed most easily using iteration. Students may need a refresher on iteration in order to complete this assignment. Lesson Closer: Complete the end of class discussion questions as a whole class or as an exit ticket. (5 mins) Discussion Questions Beginning of Class: What is the purpose of the script tag? Allows programmers to add JavaScript to an HTML file. Using the script tag, how can we ask a user for their name? var name = prompt("What is your name?)