Javascript (12) - Document Object Model - DOM [1]

2 Feb 2019 · 17 min
17:03

In this French‑language tutorial, the presenter introduces the Document Object Model (DOM) and demonstrates how to manipulate HTML elements with JavaScript. The lesson starts with a simple image‑swap example triggered by mouseover/mouseout events, showing three ways to reference the image: via document.images (array‑like collection), via document.getElementById (using a unique ID), and via document.getElementsByTagName (tag‑name collection with .item or index). The instructor then refactors the code to use the keyword this as a generic reference, and later consolidates the two separate handlers into a single function that receives the target element and an image index (or uses an array of image paths). The tutorial moves on to manipulating non‑image elements: a <div> whose innerHTML, style (color, backgroundColor, fontSize, etc.) and CSS class are changed on a button click. It explains the difference between innerHTML and value for inputs, how to set inline styles via the .style property (including camel‑casing of CSS property names), and how to apply multiple styles at once by assigning a CSS class using either the .className property or setAttribute('class', …). Throughout, the presenter emphasizes case‑sensitivity, proper syntax, and best‑practice shortcuts (e.g., using .item instead of brackets). The video concludes by noting that other DOM access methods such as querySelector and more advanced event handling will be covered later.

Chapters

More from Yamossoun

8:56
youtube.com

Compteur synchrone - Logique séquentielle

2w ago
11:58
youtube.com

Compteur asynchrone et diviseur de fréquence - Logique séquentielle

3w ago
11:37
youtube.com

Les registres (parallèle et à décalage) - Logique séquentielle

1mo ago
6:14
youtube.com

Bascule T (Toggle) - Logique séquentielle

1mo ago
12:05
youtube.com

Bascule JK - Logique séquentielle

1mo ago
9:17
youtube.com

Bascule D flip-flop active sur front montant - Logique séquentielle

1mo ago
10:08
youtube.com

Bascule D Latch - Logique séquentielle

1mo ago
8:13
youtube.com

Bascule RS - Logique séquentielle

1mo ago
5:04
youtube.com

Logique séquentielle - Introduction

2mo ago
1:15
youtube.com

Le codeur - Logique combinatoire #codeur #logique #circuit #booleanlogic

2mo ago
1:56
youtube.com

Algorithme de calcule de la racine carrée par dichotomie #dichotomy #squareroot #algorithm

3mo ago
See all content