js实现的网页颜色代码表全集

2018-09-26 20:09

阅读:624

  <!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.0Transitional//EN>
<HTML><HEAD><TITLE>网页颜色代码全集</TITLE>
<METAhttp-equiv=Content-Typecontent=text/html;charset=gb2312>
<METAcontent=MSHTML6.00.2800.1543name=GENERATOR>
<STYLEtype=text/css>TD{
FONT-SIZE:10.8pt
}
BODY{
FONT-SIZE:10.8pt
}
BUTTON{
WIDTH:5em
}
</STYLE>

<SCRIPTlanguage=JavaScript>
varSelRGB=;
varDrRGB=;
varSelGRAY=120;

varhexch=newArray(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F);

functionToHex(n)
{varh,l;

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

functionDoColor(c,l)
{varr,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);
}

functionEndColor()
{vari;

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

ShowColor.bgColor=SelColor.value;
}
</SCRIPT>

<SCRIPTlanguage=JavaScriptevent=onclickfor=ColorTable>
SelRGB=event.srcElement.bgColor;
EndColor();
</SCRIPT>

<SCRIPTlanguage=JavaScriptevent=onmouseoverfor=ColorTable>
RGB.innerText=event.srcElement.bgColor;
EndColor();
</SCRIPT>

<SCRIPTlanguage=JavaScriptevent=onmouseoutfor=ColorTable>
RGB.innerText=SelRGB;
EndColor();
</SCRIPT>

<SCRIPTlanguage=JavaScriptevent=onclickfor=GrayTable>
SelGRAY=event.srcElement.title;
EndColor();
</SCRIPT>

<SCRIPTlanguage=JavaScriptevent=onmouseoverfor=GrayTable>
GRAY.innerText=event.srcElement.title;
EndColor();
</SCRIPT>

<SCRIPTlanguage=JavaScriptevent=onmouseoutfor=GrayTable>
GRAY.innerText=SelGRAY;
EndColor();
</SCRIPT>

<SCRIPTlanguage=JavaScriptevent=onclickfor=Ok>
window.returnValue=SelColor.value;
window.close();
</SCRIPT>
</HEAD>
<BODYbgcolor=#006633text=#000000link=#000000leftMargin=0topMargin=0bgProperties=fixed>
<DIValign=center>
<p></p>
<p><fontcolor=#FF0000size=5><strong><ahref=找字网</font></a>网页颜色代
码选择器</strong></font></p>
</DIV>
<TABLEcellSpacing=1cellPadding=3width=350align=centerbgColor=#dddddd
border=0>
<TBODY>
<TRbgColor=#ffffff>
<TDalign=middlewidth=10%><SELECTonchange=selectchg(this.value)
name=select1><OPTIONvalue=1selected>红</OPTION><OPTION
value=2>绿</OPTION><OPTIONvalue=3>蓝</OPTION><OPTION
value=4>灰</OPTION></SELECT></TD>
<TDalign=middlewidth=90%>
<TABLEcellSpacing=0cellPadding=0width=100%border=0>
<TBODY>
<TR>
<TDwidth=81%align=right>颜色值
<INPUTclass=memosize=10name=text1>
<INPUTclass=buttononclick=choosecolor()type=buttonvalue=确认颜色name=Button2>
</TD>
<TDalign=rightwidth=1%></TD>
<TDwidth=18%>
<TABLEclass=cursorcrossheight=20cellSpacing=1cellPadding=0
width=40border=0>
<TBODY>
<TR>
<TDid=customcoloronmouseover=showcolor(this)
bgColor=#ffffff></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
<TRbgColor=#ffffff>
<TDalign=middlewidth=10%>
<TABLEclass=cursorhandid=tableleftcellSpacing=1cellPadding=0
border=0><SCRIPTlanguage=VBScript>
functionhexit(which)
hexit=hex(which)
endfunction
</SCRIPT>

<SCRIPTlanguage=JavaScript>
for(i=0;i<=15;++i)
{document.write(<tr><tdalign=center>+hexit(0+i*17)+</td><tdid=tdleft+i+bgcolor=rgb(+(0+i*17)+,0,0)
width=15height=15onclick=changeright(this.num)onmouseover=showcolor(this)></td></tr>)
document.all[tdleft+i].num=i
}
</SCRIPT>

<TBODY></TBODY></TABLE></TD>
<TDalign=middlewidth=90%>
<TABLEclass=cursorcrossid=tableleftcellSpacing=1cellPadding=0
border=0>
<SCRIPTlanguage=JavaScript>
document.write(<tr><td></td>)
for(i=0;i<=15;++i)
{document.write(<tdalign=center>+hexit(0+i*17)+</td>)}
document.write(</tr>)

for(i=0;i<=15;++i)
{document.write(<tr>)
document.write(<tdalign=center>+hexit(0+i*17)+</td>)
for(j=0;j<=15;++j)
{document.write(<tdid=tdrightr+i+c+j+bgcolor=rgb(0,+(0+i*17)+,+(0+j*17)+)width=15
height=15onmouseover=showcolor(this)onclick=clickright(this)></td>)}
document.write(</tr>)
}

</SCRIPT>

<TBODY></TBODY></TABLE></TD></TR>
<TRbgColor=#ffffff>
<TDcolSpan=2
height=20>·可选16*16*16种颜色。<BR>·单击左边的颜色会得到更多的颜色。<BR>·单击右边的颜色会固定选取的颜色。
<BR>·输入框可以自定义颜。


评论


亲,登录后才可以留言!