Advertisement
Shailrshah

Drop-Down List for Changing Background

Jun 7th, 2014
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.     <head>
  3.         <script language = "javascript">
  4.             function changebg(color){
  5.                 document.body.style.backgroundColor = color.value;
  6.             }
  7.         </script>
  8.     </head>
  9.     <body>
  10.         <form>
  11.             <select onchange = "changebg(this)">
  12.                 <option value = "white"> white </option>
  13.                 <option value = "green"> green </option>
  14.                 <option value = "blue"> blue </option>
  15.                 <option value = "grey"> grey </option>
  16.                 <option value = "red"> red </option>
  17.             </select>
  18.         </form>
  19.     </body>
  20. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement