HTML – How to Turn-On and Off the Light

 | Uncategorized

 

<!DOCTYPE html>
<html>
<head>
</head><body><script>
function changeImage() {
var image = document.getElementById(‘bulb’);
if (image.src.match(“bulb-on”)) {
image.src = “https://coding.thefrustratedaffiliatemarketers.com/bulb-off.gif”;
} else {
image.src = “https://coding.thefrustratedaffiliatemarketers.com/bulb-on.gif”;
}
}
</script><div class=”switchbutton” style=”display: block; position: absolute; margin-top: 250px; margin-left: 60px;”>
<img src=”https://coding.thefrustratedaffiliatemarketers.com/switch.gif”
style=”position: absolute; margin-top:; margin-left:; “>
<button onclick=”changeImage()” style=”position: absolute; margin-top: 35px; margin-left: 31px;
width: 30px; height: 35px;”></button>

</div>

<img id=”bulb” src=”https://coding.thefrustratedaffiliatemarketers.com/bulb-off.gif”
style=”height: 200px; margin-left: 220px; margin-top: 180px; position: absolute;”>

</body>

</html>