I have the following HTML + JavaScript Code for Changing background color of HTML Page from JS based on the color option chosen. However irrespective of any label I choose, my background is turning red only on mouseover and white on mouseout. Rest of the color changes are not happening. Where am I going wrong?
<html> <head> <title> Color Highlighter </title> <script type="text/javascript"> function changeColor(target) { document.body.style.background = target; } function restoreColor() { document.body.style.background ="white"; } </script> </head> <body> <label onmouseover="changeColor('red');" onmouseout="restoreColor();">Red<br> <label onmouseover="changeColor('blue');" onmouseout="restoreColor();">Blue<br> <label onmouseover="changeColor('yellow');" onmouseout="restoreColor();">Yellow<br> <label onmouseover="changeColor('green');" onmouseout="restoreColor();">Green<br> </body> 
labelelements properly …