Untitled
<!DOCTYPE html> <html> <head> <style> #bulb { width: 100px; height: 100px; background-color: gray; border-radius: 50%; } </style> </head> <body> <div id="bulb"></div> <button onclick="turnOnOff()">Turn On/Off</button> <script> let isOn = false; function turnOnOff() { const bulb = document.getElementById('bulb'); if (isOn) { bulb.style.backgroundColor = 'gray'; } else { bulb.style.backgroundColor = 'yellow'; } isOn = !isOn; } </script> </body> </html>