<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script> function setbg() { var colorObj=document.myform.mybg; var vv=colorObj.value; alert(vv); } </script> </head> <body> <form name="myform"> <table> <tr> <td>请选择颜色:</td> <td> <input type="color" name="mybg" value="#ccc" onchange="setbg()"> </td> </tr> </table> </form> </body> </html>