Exercise: Clicking a table entry
Write JavaScript code so that when the table entry with the Z is clicked, the background colour becomes yellow. The CSS class yellow
has already been defined for you.
Note:
Hints:
Use
window.onload
.
Solution to the exercise
Here is one possible solution.
Note:
Hints:
- undefined
1
2
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
td {
text-align: center;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX