使用jQuery插件
你可以很容易的使用jQuery插件,以一個顏色選取器爲例:
1.首先你可以搜索到一個插件提供者的網站下載你需要的jQuery插件:http://feiyu.asgard.cn/down/jquery.colorPicker-1.1.0.pack.js(緋雨的天空)
2.在<head > 標籤中,將上面的js文件引用,添加在jQuery引用的後面就可以安裝插件文檔的使用方法使用了,代碼如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="jquery.js" type="text/javascript"></script> <!-- 要注意的是將插件的js引用標籤,放在jQuery引用標籤的後面。 --> <script src="jquery.colorPicker.js" type="text/javascript"></script> </head> <body> <form id="form1" runat="server"> <input type="text" name="text2" readonly="readonly" onclick="$(this).colorPicker({ setValue:true,setBackground:false })" /> </form> </body> </html>
運行效果如下:
文章出自:http://www.cnblogs.com/finehappy/archive/2009/05/24/1488082.html