| Ex No: 9 | SET BACKGROUND COLOR |
|---|---|
| Aim: | To write a JavaScript code to set the background color of elements in HTML. |
| Algorithm | |
| Step1: Create a folder “Ex9” to place the HTML files. | |
| Step2: Create HTML file “index.html”. | |
| Step3: Use document.getElementById and document.getElementsByTagName method to get the paragrap, header and footer object. | |
| Step4: Use style.background property to set the background color of the selected elements. | |
| Step5: When Pagaraph is clicked change the background color. | |
| Source Code | |
index.html
|
|
| Result: | Thus JavaScript code is written to set background color of elements in HTML. |