This program doesn't work. I just copy pasted into my editor. Please look into the mistakes. Thanks.
<html>
<head>
<title>Introduction</title>
<script>
function togglebackgroundcolor() {
// document.body returns the body tag
var bodytag = document.body;
var backgroundColor = bodytag.style.background;
var btag = document.getElementsByTagName("b")[0];
// if background is lightgreen set it to beige
if (backgroundColor === "lightgreen") {
bodytag.style.background = "beige";
btag.style.visibility = "hidden";
}
// else if background is beige set it to lightgreen
else if (backgroundColor === "beige") {
bodytag.style.background = "lightgreen";
btag.style.visibility = "visible";
}
}
</script>
</head>
<body style="background: lightgreen;">
<b style="font-size: 40px;">
Hello World!
</b>
<p>
Random sentences with no meaning coming up... <br />
Attention he extremity unwilling on otherwise. Conviction up partiality as
delightful is discovered. <br />
<i> Fin </i>
</p>
<button onclick="togglebackgroundcolor()">
Toggle background color
</button>
</body>
</html>