官网:http://acko.net/dev/farbtastic
用法:
1、首先要在页面引用JQuery,然后在页面引用farbtastic.js和farbtastic.css(Include farbtastic.js and farbtastic.css in your HTML):
<script type="text/javas
<link rel="stylesheet" href="farbtastic.css" type="text/css" />
2、在页面放一个文本框和一个DIV,asp.net可以放一个服务端的文本框,这样我们就可以在后台取到前台设置的颜色了(Add a placeholder div and a text field to your HTML, and give each an ID):
<form><input type="text" id="color" name="color" value="#123456" /></form>
<div id="colorpicker"></div>
3、用以下代码在页面注册ready事件,将第二步建立的DIV和文本框的ID放到以下红色部分,注意语法。(Add a ready() handler to the document which initializes the color picker and link it to the text field with the following syntax):
<script type="text/javas
$(document).ready(function() {
$('#colorpicker').farbtastic('#color');
});
</script>
做好这三步,我们就可以使用这个很方便的调色板了,无聊的时候还可以当小游戏来玩一下。。。