Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>New HTML5 Input Types</title>
- </head>
- <script>
- function start() {
- var button = document.getElementById( "border" );
- button.addEventListener( "click", bodycolor, false );
- }
- function bodycolor() {
- var x = document.forms;
- document.body.setAttribute( "style",
- "background-color: " + x[0].n1.value );
- }
- window.addEventListener( "load", start, false );
- </script>
- <body>
- <form action = "#">
- <input type = "color" name = "n1">
- <input id = "border" type = "button" value = "I eat color">
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment