JavaScript Background change using switch
JavaScript
Download (.zip)
<script language=javascript> <!-- var color=prompt("What is your color?",""); switch(color){ case "red": document.bgColor="color"; document.write("Red is hot."); break; case "yellow": document.bgColor=color; document.write("Yellow is warm."); break; case "green": document.bgColor="lightgreen"; document.write("Green is soothing."); break; case "blue": document.bgColor="#RRGGBB"; document.write("Blue is cool."); break; default: document.bgColor="white"; document.write("Not available today. We'll use white"); break; } //--> </script>
|