• Color Picker with HTML5 and Javascript

    Here, I have given code for color picker. Please create the html file and run the code in browser.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript">
    function processData(c1,c2) {
    var cv1 = document.getElementById(c1).value;
    var cv2 = document.getElementById(c2).value;
    alert(cv1+"\n"+cv2);
    }
    </script>
    </head>
    <body>
    <h2>Color Picker with HTML5 and Javascript</h2>
    Choose Color 1: <input type="color" name="color1" id="color1" /><br /><br />
    Choose Color 2: <input type="color" name="color2" id="color2" /><br /><br />
    <input type="button" onClick="processData('color1','color2')" value="Submit" />
    </body>
    </html>

Comments on this post

Leave a Reply

  • Security Code :


    6 + four =