下面是源码 需要浏览器支持html5
复制代码代码如下:
html
head
/head
body
canvas id="colorPicker" onmousemove="showCurrentColor(event)"
/canvas
br/
div id="textResult"
/div
script type="text/javascript"
if(document.createElement("canvas")){
if(document.getElementById("colorPicker").getContext){
var can = document.getElementById("colorPicker");
can.setAttribute("height",300);
var cxt = can.getContext("2d");
var gradient = cxt.createLinearGradient(0.5,0.5,0,150);