Change BackGround Color using JS

HTML
<html> <body> <center><br> <form> <select name="clr" id="clr"> <option value="red">Red</option> <option value="green">Green</option> <option value="blue">Blue</option> <option value="white">White</option> <option value="black">Black</option> </select> <input type="button" value="Change Color" onClick="color()"> </form> </center> </body> </html>
CSS
JAVASCRIPT
function color() { var clr=document.getElementById('clr').value; if(clr=='red') document.bgColor='red'; if(clr=='green') document.bgColor='green'; if(clr=='blue') document.bgColor='blue'; if(clr=='white') document.bgColor='white'; if(clr=='black') document.bgColor='black'; }
Expand for more options Login