js js获取颜色,js颜色条,颜色条筛选,点击颜色条获取颜色值
从网上看到,自动选择标题的颜色值,点击颜色条某处,显示该处颜色值
颜色条地址:颜色条地址
点击中间颜色,该颜色值将出现在下框里。
网站制作学习网 |
颜 色: |
//js代码如下,www.forasp.cn网站制作学习网原创,转载请注明。
var height1 = 18; // define the height of the color bar
var pas = 36; // define the number of color in the color bar
var width1=1; //forasp.cn
var base_hexa = "0123456789ABCDEF";
function dec2Hexa(number)
{ return base_hexa.charAt(Math.floor(number / 16)) + base_hexa.charAt(number % 16);}
function RGB2Hexa(TR,TG,TB){return "#" + dec2Hexa(TR) + dec2Hexa(TG) + dec2Hexa(TB);}
function lightCase(MyObject,objName){MM_findObj(objName).bgColor = MyObject.bgColor;}
col = new Array;
col[0] = new Array(255,0,255,-1,255,-1);
col[1] = new Array(255,0,0,1,0,0);
col[2] = new Array(255,-1,255,0,0,0);
col[3] = new Array(0,0,255,0,0,1);
col[4] = new Array(0,0,255,-1,255,0);
col[5] = new Array(0,1,0,0,255,0);
col[6] = new Array(255,-1,0,0,255,-1);
function rgb(pas,w,h){
for (j=0;j<6+1;j++){
for (i=0;i r = Math.floor(col[j][0]+col[j][1]*i*(255)/pas); g = Math.floor(col[j][2]+col[j][3]*i*(255)/pas); b = Math.floor(col[j][4]+col[j][5]*i*(255)/pas); codehex = r + '' + g + '' + b;//www.forasp.cn document.write(' \n');//网站制作学习网
}
}
}
function change_bg(bg)
{
document.getElementById("abc").value = bg;
}
更多信息请查看IT技术专栏