HTML调色版

None.gif < html >
None.gif
< head >
None.gif
< title ></ title >
None.gif
< meta  http-equiv ="content-type"  content ="text/html; charset=gb2312" >
ExpandedBlockStart.gifContractedBlock.gif
< style  type ="text/css" > dot.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif body
{dot.gif}{}{dot.gif}{background-color: buttonface; }
ExpandedSubBlockStart.gifContractedSubBlock.gif input
{dot.gif}{}{dot.gif}{font-size:9pt;font-family: "verdana,tahoma,arial,sans-serif";}
ExpandedSubBlockStart.gifContractedSubBlock.gif button
{dot.gif}{}{dot.gif}{height:24px;font-size:10pt;font-family: "verdana,tahoma,arial,sans-serif";}
None.gif
</ style >
None.gif
</ head >
None.gif
< body  onSelectStart ="return false;"  style ="margin: 0px;padding: 0px;" >
ExpandedBlockStart.gifContractedBlock.gif
< script  language ="JavaScript" > dot.gif
InBlock.gifdocument.title
="颜色选择"+ document.title;
InBlock.gif
var iW = 30;//共有6种颜色,每种颜色的宽为iW。iW*6为色带的宽。
InBlock.gif
var iH = '152';//iH为色带的高。
InBlock.gif
var iT =20;
InBlock.gif
var iL = 0;
InBlock.gif
//var iT = (document.body.offsetHeight-iH)/2;
InBlock.gif
var H,S,V;
InBlock.gif
var sr,sg,sb;
ExpandedBlockEnd.gif
var curColor="#000000";
None.gif
</ script >
None.gif
< table  cellspacing ="0"  cellpadding ="0" >
None.gif    
< tr >  
None.gif        
< td >     
None.gif            
< input  type =text  disabled =true  size =9  id =ShowColor  style ="background-color:#000000;disabled:true;" >< input  type =text  disabled =true  size =15  id =SelColor  value ="#000000" >
None.gif    
</ td >
None.gif  
</ tr >
None.gif
</ table >
ExpandedBlockStart.gifContractedBlock.gif
< script  language ="Javascript" > dot.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif
function SetColor()dot.gif{
InBlock.gif    SelColor.value
=curColor.toUpperCase();
InBlock.gif    ShowColor.style.background
=curColor;
ExpandedSubBlockEnd.gif}

ExpandedSubBlockStart.gifContractedSubBlock.gif
function HSV()dot.gif{
InBlock.gif    
var pX = event.offsetX;
InBlock.gif    
var pY = event.offsetY;
InBlock.gif    
var HalfH = parseInt(iH/2);
InBlock.gif    H 
= parseInt(pX*360/(iW*6));
ExpandedSubBlockStart.gifContractedSubBlock.gif    
if(event.offsetY < HalfH)dot.gif{
InBlock.gif        S 
= pY/HalfH;
InBlock.gif        V 
= 1;
ExpandedSubBlockStart.gifContractedSubBlock.gif    }
elsedot.gif{
InBlock.gif        S 
= 1;
InBlock.gif        V 
= (iH-pY)/HalfH;
ExpandedSubBlockEnd.gif    }

InBlock.gif    HSVtoRGB();
InBlock.gif    rgb
=RGB2HTML();
InBlock.gif    
//HSV.value = 'H:'+H+'  S:'+parseInt(S*100)+'%   V:'+parseInt(V*100)+'%';
InBlock.gif
    //RGB.value = 'R:'+sr+'  G:'+sg+'   B:'+sb;
InBlock.gif
    SelColor.value="#"+rgb.toUpperCase();
InBlock.gif    ShowColor.style.background
= '#'+rgb;
ExpandedSubBlockEnd.gif}

ExpandedSubBlockStart.gifContractedSubBlock.gif
function HSVtoRGB()dot.gif{
InBlock.gif    
var r,g,b;
InBlock.gif    
var k = (H%60)/60;
InBlock.gif    
var c1 = V*(1-S);
InBlock.gif    
var c2 = V*(1-S*k);
InBlock.gif    
var c3 = V*(1-S*(1-k));
ExpandedSubBlockStart.gifContractedSubBlock.gif    
switch(parseInt(H/60))dot.gif{
InBlock.gif        
case 0 : r=V,g=c3;b=c1; break;
InBlock.gif        
case 1 : r=c2,g=V;b=c1; break;
InBlock.gif        
case 2 : r=c1,g=V;b=c3; break;
InBlock.gif        
case 3 : r=c1,g=c2;b=V; break;
InBlock.gif        
case 4 : r=c3,g=c1;b=V; break;
InBlock.gif        
case 5 : r=V,g=c1;b=c2; break;
ExpandedSubBlockEnd.gif    }

InBlock.gif    sr 
= parseInt(r*255);
InBlock.gif    sg 
= parseInt(g*255);
InBlock.gif    sb 
= parseInt(b*255);
ExpandedSubBlockEnd.gif}

ExpandedSubBlockStart.gifContractedSubBlock.gif
function RGB2HTML()dot.gif{
InBlock.gif    
var r=(sr>=16)?sr.toString(16):('0'+sr.toString(16));
InBlock.gif    
var g=(sg>=16)?sg.toString(16):('0'+sg.toString(16));
InBlock.gif    
var b=(sb>=16)?sb.toString(16):('0'+sb.toString(16));
InBlock.gif    
return r+g+b;
ExpandedSubBlockEnd.gif}

ExpandedSubBlockStart.gifContractedSubBlock.gif
function finsh()dot.gif{
InBlock.gif    window.returnValue 
= SelColor.value;
InBlock.gif    window.close();
ExpandedSubBlockEnd.gif}

ExpandedSubBlockStart.gifContractedSubBlock.gif
function window.onload()dot.gif{
InBlock.gif    
var iHtml = '';
InBlock.gif    
var RainBow = [255,0,0,  255,255,0,  0,255,0,  0,255,255,  0,0,255,  255,0,255,  255,0,0];
ExpandedSubBlockStart.gifContractedSubBlock.gif    
for(var i=0;i<6;i++)dot.gif{
InBlock.gif        
var R1 = RainBow[i*3];
InBlock.gif        
var G1 = RainBow[i*3+1];
InBlock.gif        
var B1 = RainBow[i*3+2];
InBlock.gif        
var R2 = RainBow[(i+1)*3];
InBlock.gif        
var G2 = RainBow[(i+1)*3+1];
InBlock.gif        
var B2 = RainBow[(i+1)*3+2];
InBlock.gif        iHtml 
+= "<span style='position:absolute;left:"+(i*iW+iL)+";top:"+iT+";width:"+iW+";height:"+iH+";background:rgb("+R1+","+G1+","+B1+");'></span><span style='position:absolute;left:"+(i*iW+iL)+";top:"+iT+";width:"+iW+";height:"+iH+";background:rgb("+R2+","+G2+","+B2+");filter:alpha(opacity=0,finishopacity=100,Style=1);'></span>"
ExpandedSubBlockEnd.gif    }

InBlock.gif    iHtml 
+= "<span style=position:absolute;left:"+iL+";top:"+iT+";width:"+iW*6+";height:"+iH/2+";background:rgb(255,255,255);filter:alpha(opacity=100,finishOpacity=0,style=1,starty=0,finishy=100,startx=0,finishx=0)></span><span style=position:absolute;left:"+iL+";top:"+(iT+iH/2)+";width:"+iW*6+";height:"+iH/2+";background:rgb(0,0,0);filter:alpha(opacity=0,finishOpacity=100,style=1,starty=0,finishy=100,startx=0,finishx=0)></span><span style='cursor:crosshair;position:absolute;left:"+iL+";top:"+iT+";width:"+iW*6+";height:"+iH+";' οnmοusemοve=HSV() οndblclick=finsh() οnclick='curColor=SelColor.value' οnmοuseοut=SetColor()></span>"
InBlock.gif    document.body.innerHTML
+=iHtml;
InBlock.gif    SetColor();
ExpandedBlockEnd.gif}

None.gif
</ script >
None.gif
</ body >
None.gif
</ html >
posted on 2005-07-24 13:02 kamlau 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/ltjabc/archive/2005/07/24/199054.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值