Activity 8
Correct Answers
1. What is commonly used for form validation? ✅ Event handlers
2. What property identifies the HTML element that fired an event? ✅ event.target
3. Which function is used for animations? ✅ setInterval()
4. What prevents invalid inputs in a number field? ✅ onkeypress="return isNumber(event)"
5. What is the default event propagation mode? ✅ Bubbling
6. Which event triggers when an input box loses focus? ✅ onblur
7. Which mouse event is triggered on a double click? ✅ ondblclick
8. What event fires when the mouse enters an element and its children? ✅ onmouseover
9. What method prevents pasting invalid characters into an input box? ✅ onpaste="return false"
10. What CSS property is essential for element animation? ✅ position: absolute
Instructions:
Set Up Your Development Environment
- Open your preferred code editor (e.g., VS Code, Sublime Text, or Notepad++).
- Create a new file and save it with the
.htmlextension (e.g., InputFieldChangeColor.html).
Change Background Color by User Input
- Create an input field where users can enter a color name or hex code.
- Add a button that, when clicked, changes the background color to the entered value.
- Ensure the color updates instantly upon clicking the button.
Final Output
- ✅ A webpage where users can change the background color by entering a color.
- ✅ The input field should be focused automatically when the page loads.
- ✅ The color should apply instantly when clicking the button.