Exercise 7 (Copy 4680)
✨ NARUMOL THONGCHUE
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Jabont.com</title> <style> :root { --s: 0%; } .xexe { background: hsl(0, var(--s), 50%); } </style> </head> <body> <h1 id="xyz">Hello World</h1> <h2 id="abc"></h2> <div id="wrap1"></div> <script> for (let i = 0; i < 11; i++) { wrap1.innerHTML += `<div class="xexe" style="--s:${ i * 10 }%">${i}</div>`; } function change(){ let box = document.querySelectorAll(".xexe"); let range = document.querySelector("#change").value; for(let i=0; i<11; i++){ box[i].style.backgroundColor = 'hsl(${range}, 100%, ${i*10}%)'; } } </script> <input type="range" min="0" max="360" step="10" oninput = "change()" id = "change" /> </body> </html>