标题:咱这坛子上的调色板不错,拿下来大家玩玩~
只看楼主
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
 问题点数:0 回复次数:3 
咱这坛子上的调色板不错,拿下来大家玩玩~

<HTML>
<HEAD>
<TITLE>多功能编辑器--调色板工具</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<Link rel="stylesheet" type="text/css" href="pop.css">
<SCRIPT LANGUAGE=JavaScript>
var SelRGB = '#000000';
var DrRGB = '';
var SelGRAY = '120';

var hexch = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');

function ToHex(n)
{ var h, l;

n = Math.round(n);
l = n % 16;
h = Math.floor((n / 16)) % 16;
return (hexch[h] + hexch[l]);
}

function DoColor(c, l)
{ var r, g, b;

r = '0x' + c.substring(1, 3);
g = '0x' + c.substring(3, 5);
b = '0x' + c.substring(5, 7);

if(l > 120)
{
l = l - 120;

r = (r * (120 - l) + 255 * l) / 120;
g = (g * (120 - l) + 255 * l) / 120;
b = (b * (120 - l) + 255 * l) / 120;
}else
{
r = (r * l) / 120;
g = (g * l) / 120;
b = (b * l) / 120;
}

return '#' + ToHex(r) + ToHex(g) + ToHex(b);
}

function EndColor()
{ var i;

if(DrRGB != SelRGB)
{
DrRGB = SelRGB;
for(i = 0; i <= 30; i ++)
GrayTable.rows(i).bgColor = DoColor(SelRGB, 240 - i * 8);
}

SelColor.value = DoColor(RGB.innerText, GRAY.innerText);
ShowColor.bgColor = SelColor.value;
}
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=ColorTable EVENT=onclick>
SelRGB = event.srcElement.bgColor;
EndColor();
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=ColorTable EVENT=onmouseover>
RGB.innerText = event.srcElement.bgColor.toUpperCase();
EndColor();
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=ColorTable EVENT=onmouseout>
RGB.innerText = SelRGB;
EndColor();
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=GrayTable EVENT=onclick>
SelGRAY = event.srcElement.title;
EndColor();
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=GrayTable EVENT=onmouseover>
GRAY.innerText = event.srcElement.title;
EndColor();
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=GrayTable EVENT=onmouseout>
GRAY.innerText = SelGRAY;
EndColor();
</SCRIPT>
<SCRIPT LANGUAGE=JavaScript FOR=Ok EVENT=onclick>
window.returnValue = SelColor.value;
window.close();
</SCRIPT>
</HEAD>
<BODY bgcolor=menu>
<div align="center"><center><table border="0" cellspacing="10" cellpadding="0"><tr><td>
<TABLE ID=ColorTable BORDER=0 CELLSPACING=0 CELLPADDING=0 style='cursor:pointer'>
<SCRIPT LANGUAGE=JavaScript>
function wc(r, g, b, n)
{
r = ((r * 16 + r) * 3 * (15 - n) + 0x80 * n) / 15;
g = ((g * 16 + g) * 3 * (15 - n) + 0x80 * n) / 15;
b = ((b * 16 + b) * 3 * (15 - n) + 0x80 * n) / 15;

document.write('<TD BGCOLOR=#' + ToHex(r) + ToHex(g) + ToHex(b) + ' height=8 width=8></TD>');
}

var cnum = new Array(1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0);

for(i = 0; i < 16; i ++)
{
document.write('<TR>');
for(j = 0; j < 30; j ++)
{
n1 = j % 5;
n2 = Math.floor(j / 5) * 3;
n3 = n2 + 3;

wc((cnum[n3] * n1 + cnum[n2] * (5 - n1)),
(cnum[n3 + 1] * n1 + cnum[n2 + 1] * (5 - n1)),
(cnum[n3 + 2] * n1 + cnum[n2 + 2] * (5 - n1)), i);
}

document.writeln('</TR>');
}
</SCRIPT>
</TABLE></td><td>
<TABLE ID=GrayTable BORDER=0 CELLSPACING=0 CELLPADDING=0 style='cursor:hand'>
<SCRIPT LANGUAGE=JavaScript>
for(i = 255; i >= 0; i -= 8.5)
document.write('<TR BGCOLOR=#' + ToHex(i) + ToHex(i) + ToHex(i) + '><TD TITLE=' + Math.floor(i * 16 / 17) + ' height=4 width=20></TD></TR>');
</SCRIPT>
</TABLE>
</td></tr>
</table>
</center></div>

<div align="center"><center>
<table border="0" cellspacing="10" cellpadding="0" width="100%">
<tr><td rowspan="2" align="center" width=70>
<table ID=ShowColor bgcolor="#000000" border="1" width="50" height="40" cellspacing="0" cellpadding="0">
<tr><td></td></tr>
</table>
</td>
<td rowspan="2">基色 : <SPAN ID=RGB>#000000</SPAN><BR>
亮度 : <SPAN ID=GRAY>120</SPAN><BR>
代码 : <INPUT TYPE=TEXT SIZE=7 ID=SelColor value="#000000"></td>
<td width=50><BUTTON id=Ok type=submit>确定</BUTTON></td></tr>
<tr><td width=50><BUTTON onclick=window.close();>关闭</BUTTON></td></tr>
</table></center></div>

</BODY>
</HTML>

搜索更多相关主题的帖子: 坛子 调色板 
2007-06-08 13:05
yndkai
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:275
专家分:0
注 册:2007-6-1
得分:0 
高手做的东东一定要收
以备研究

本来讨厌下雨的天空 直到听见有人说爱我
2007-06-09 10:44
汤姆猫
Rank: 1
等 级:新手上路
威 望:1
帖 子:52
专家分:0
注 册:2006-10-16
得分:0 
可不可以把注释写上去啊

新技术创造新生活!
2007-06-15 08:39
kkynietg
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2007-6-21
得分:0 
这是eWebEditor上用的选色器吧
2007-06-21 11:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-145896-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.227716 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved