daily pastebin goal
15%
SHARE
TWEET

Untitled

a guest Nov 24th, 2017 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.    <head>
  4.       <meta charset="utf-8">
  5.       <title>New HTML5 Input Types</title>
  6.    </head>
  7.    <script>
  8.    
  9.         function start() {
  10.         var button = document.getElementById( "border" );
  11.         button.addEventListener( "click", bodycolor, false );
  12.         }
  13.        
  14.         function bodycolor() {
  15.         var x = document.forms;
  16.          document.body.setAttribute( "style",
  17.            "background-color: " + x[0].n1.value );    
  18.  
  19.         }
  20.         window.addEventListener( "load", start, false );
  21.     </script>
  22.    <body>
  23.       <form action = "#">
  24.       <input type = "color" name = "n1">
  25.         <input id = "border" type = "button" value = "I eat color">
  26.       </form>
  27.    </body>
  28. </html>
RAW Paste Data
Top