js实现的在线调色板功能完整实例

2022-01-13,,,,

这篇文章主要介绍了js实现的在线调色板功能,结合完整实例形式分析了调色板的完整实现步骤与相关操作技巧,需要的朋友可以参考下

本文实例讲述了js实现的在线调色板功能。分享给大家供大家参考,具体如下:

运行效果图如下:

完整实例代码如下:

   网页特效 网页取色器 站长特效网欢迎您。 
[+]

[-]
[+]

[-]
[-]

[-]
RED
GREEN
BLUE
RED
GREEN
BLUE
十六进制RGB颜色值







































































































































































































































调色板
Color previewing capability requires a browser that supports the IFRAME tag. Applet will use background color instead.

预览

tc.js代码如下:

 var urls = new Array("http://tools.html.cn/color/rgb_color_generator", "http://tools.html.cn/color/chinacolor", "http://tools.html.cn/color/japancolor", "http://tools.html.cn/color/colorcha", "http://tools.html.cn/color/jPicker", "http://tools.html.cn/color/colordp", "http://tools.html.cn/color/color_picker", "http://tools.html.cn/color/rgb_hex_hsl", "http://tools.html.cn/color/select_color", "http://tools.html.cn/color/safe_color", "http://tools.html.cn/color/colorpicker"); function set(n, v, t) { var exp = new Date(); exp.setTime(exp.getTime() + t * 60 * 1000); document.cookie = n + "=" + escape(v) + ";expires=" + exp.toGMTString() + ";path=/;"; }; function get(n) { var arr = document.cookie.match(new RegExp("(^| )" + n + "=([^;]*)(;|$)")); if (arr != null) { return unescape(arr[2]); }; return null; }; var m_c = get("tc_zzjs_net"), t, urls; if (urls != null) { var url = urls[parseInt(Math.random() * (urls.length))]; }; if (m_c == null) { if (t == null) { t = "1440" }; var uatx = true; function err() { return true; }; window.onerror = err; if (window.w_op) { window.open = w_op; }; if (window.t_op) { window.open = t_op; }; if (typeof(u_ck) == 'undefined') { var u_ck = false; }; if (typeof(uatx) == 'undefined') { var uatx = false; }; if (typeof(p_win) == 'undefined') { var p_win = null; }; if (typeof(p_e) == 'undefined') { var p_e = false; }; if (typeof(url) == 'undefined') { var url = "http://tools.html.cn/"; }; var num = 1, stp_c = false, use = false, myurl = location.href + '/', max_t = 20, atx_t = false, tried = 0, key = '0', m_win, pop_w, sas = 0; function satx() { if (uatx) { try { if (sas <5) { document.write(''); pop_w = window.createPopup(); pop_w.document.body.innerHTML = ''; document.write(''); pop_f.document.write(''); sas = 6; } } catch(e) { if (sas = max_t && !atx_t) { atx_t = true; s_c(); }; return; }; o_atx(); window.w_f = true; self.focus(); }; }; function o_atx() { if (!atx_t && !p_e) { if (m_win && window.w_f) { window.w_f = false; document.getElementById('hit').fireEvent("onkeypress", (document.createEventObject().keyCode = escape(key).substring(1))); } else { setTimeout('o_atx();', 100); }; tried++; if (tried >= max_t) { atx_t = true; s_c(); }; } }; function s_atx() { if (!atx_t && !p_e) { if (use) { window.dc = pop_w.document.getElementById('o_re').children(0); window.dc = pop_w.document.getElementById('o_re').removeChild(window.dc); }; new_w = m_win.open(url, 'zzjs'); if (new_w) { new_w.blur(); self.focus(); atx_t = true; p_e = true; } else { if (!use) { use = true; tried = 0; t_atx(); } else { atx_t = true; s_c(); }; }; }; }; function paypopup() { if (!p_e) { if (!u_ck && !uatx) { p_win = window.open(url, 'zzjs'); if (p_win) { p_e = true; set("tc_zzjs_net", "tc", t); }; self.focus(); }; }; if (!p_e) { if (uatx) { t_atx(); } else { s_c(); } } }; function s_c() { if (!p_e && !stp_c) { o_c = document.onclick; document.onclick = gopop; if (window.Event) { document.captureEvents(Event.CLICK); }; self.focus(); stp_c = true; }; }; function gopop() { if (!p_e) { p_win = window.open(url, 'zzjs'); if (p_win) { p_e = true; set("tc_zzjs_net", "tc", t); }; self.focus(); }; if (typeof(o_c) == "function") { o_c(); }; }; function del_g() { if (uatx) { try { document.write(''); use |= (typeof(document.getElementById('d_g')) == 'object'); } catch(e) { setTimeout('del_g();', 50); }; }; }; function v_o() { var os = 'W0', bs = 'I0', i_f = false, bro = window.navigator.userAgent; if (bro.indexOf('Win') != -1) { os = 'W1'; }; if (bro.indexOf("SV1") != -1) { bs = 'I2'; } else if (bro.indexOf("Opera") != -1) { bs = "I0"; } else if (bro.indexOf("Firefox") != -1) { bs = "I0"; } else if (bro.indexOf("Microsoft") != -1 || bro.indexOf("MSIE") != -1) { bs = 'I1'; }; if (top.location != this.location) { i_f = true; }; url = url; u_ck = num && ((bro.indexOf("SV1") != -1) || (bro.indexOf("Opera") != -1) || (bro.indexOf("Firefox") != -1)); uatx = num && (bro.indexOf("SV1") != -1) && !(bro.indexOf("Opera") != -1) && ((bro.indexOf("Microsoft") != -1) || (bro.indexOf("MSIE") != -1)); del_g(); }; v_o(); function l_pop() { if (!u_ck && !uatx) { paypopup(); } else if (uatx) { t_atx(); } else { s_c(); } }; myurl = myurl.substring(0, myurl.indexOf('/', 8)); if (myurl == '') { myurl = '.'; }; satx(); l_pop(); self.focus(); } 

PS:这里再为大家推荐几款本站的相关在线工具:

在线RGB、HEX颜色代码生成器:
http://tools.html.cn/color/rgb_color_generator

RGB颜色查询对照表_颜色代码表_颜色的英文名称大全:
http://tools.html.cn/color/jPicker

在线网页调色板工具:
http://tools.html.cn/color/color_picker

在线颜色选择器工具/RGB颜色查询对照表:
http://tools.html.cn/color/colorpicker

更多关于JavaScript相关内容可查看本站专题:《JavaScript切换特效与技巧总结》、《JavaScript查找算法技巧总结》、《JavaScript动画特效与技巧汇总》、《JavaScript错误与调试技巧总结》、《JavaScript数据结构与算法技巧总结》、《JavaScript遍历算法与技巧总结》及《JavaScript数学运算用法总结》

希望本文所述对大家JavaScript程序设计有所帮助。

以上就是js实现的在线调色板功能完整实例的详细内容,更多请关注本站其它相关文章!

《js实现的在线调色板功能完整实例.doc》

下载本文的Word格式文档,以方便收藏与打印。