<!DOCTYPE html>
<html>
<head>
<title>background change</title>
</head>
<body>
<div onclick=”change(this)” style=”background-color:red;width:100%;height:30em;color:blue;text-align:center;line-height:30em;”>click me to change</div>
<button id=”tio”>click</button>
<p id=”tfr”>i am a boy</p>
<button id=”ctc” onclick=”answer()”>change</button>
<script>
function change(element){
let gyt= element.style.backgroundColor;
if (gyt == “red”){
element.style.backgroundColor=”green”;
} else{
element.style.backgroundColor=”red”;
}
}
</script>
</body>
</html>
