File Name : colorpicker.html Requirement : Internet Explorer or Mozilla Author : Jean-Luc Antoine Submitted : 26/03/2005 Category : 4K 复制代码 代码如下: Couleur:Cliquez pour lister lesoeuvres les plus prochesde la couleur sélectionnée <BR><!--<BR>var total=1657;var X=Y=j=RG=B=0;<BR>var aR=new Array(total);var aG=new Array(total);var aB=new Array(total);<BR>for (var i=0;i<256;i++){<BR>aR[i+510]=aR[i+765]=aG[i+1020]=aG[i+5*255]=aB[i]=aB[i+255]=0;<BR>aR[510-i]=aR[i+1020]=aG[i]=aG[1020-i]=aB[i+510]=aB[1530-i]=i;<BR>aR[i]=aR[1530-i]=aG[i+255]=aG[i+510]=aB[i+765]=aB[i+1020]=255;<BR>if(i<255){aR[i/2+1530]=127;aG[i/2+1530]=127;aB[i/2+1530]=127;}<BR>}<BR>function p(){var jla=document.getElementById('choix');jla.innerHTML=artabus;jla.style.backgroundColor=artabus;document.forms['recherche'].rgb.value=artabus}<BR>var hexbase=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");<BR>var i=0;var jl=new Array();<BR>for(x=0;x<16;x++)for(y=0;y<16;y++)jl[i++]=hexbase[x]+hexbase[y];<BR>document.write('<'+'table border="0" cellspacing="0" cellpadding="0" onMouseover="t(event)" onClick="p()">');<BR>var H=W=63;<BR>for (Y=0;Y<=H;Y++){<BR> s='<'+'tr height=2>';j=Math.round(Y*(510/(H+1))-255)<BR> for (X=0;X<=W;X++){<BR> i=Math.round(X*(total/W))<BR> R=aR[i]-j;if(R<0)R=0;if(R>255||isNaN(R))R=255<BR> G=aG[i]-j;if(G<0)G=0;if(G>255||isNaN(G))G=255<BR> B=aB[i]-j;if(B<0)B=0;if(B>255||isNaN(B))B=255<BR> s=s+'<'+'td width=2 bgcolor=#'+jl[R]+jl[G]+jl[B]+'><'+'/td>'<BR> }<BR> document.write(s+'<'+'/tr>')<BR>}<BR>document.write('<'+'/table>');<BR>var ns6=document.getElementById&&!document.all<BR>var ie=document.all<BR>var artabus=''<BR>function t(e){<BR>source=ie?event.srcElement:e.target<BR>if(source.tagName=="TABLE")return<BR>while(source.tagName!="TD" && source.tagName!="HTML")source=ns6?source.parentNode:source.parentElement<BR>document.getElementById('temoin').style.backgroundColor=artabus=source.bgColor<BR>}<BR>// --><BR> 来源:http://www.interclasse.com/scripts/colorpicker.php