宝哥软件园

javascript实现根据3原色制作颜色选择器的方法

编辑:宝哥软件园 来源:互联网 时间:2021-09-09

本文实例讲述了爪哇岛描述语言实现根据3原色制作颜色选择器的方法。分享给大家供大家参考。具体如下:

文件。write(' div id=' ms color ' div class=' aa ' div class=' ab ' div class=' ab1 ' select on change=' t . f(this。值)'选项值='1 '红/optionoption值='3 '绿/optionoption值='5 '蓝/optionoption值='7 '灰/option/select/div div id=' ms color _ ab2 '输入类型=' text ' maxlength=' 7 ' span/span/div/div class=' AC ' div id=' ms color _ ac1 '/div div id=' ms color _ ac2 '/div/div/div ');t={ s 3360 true };t . a=a . $(' ms color _ ab2 ').子级[0];t . b=a . $(' ms color _ ab2 ').孩子[1];t . c=a . $(' ms color _ ac1 ');t . d=a . $(' ms color _ ac2 ');T.ini=函数(id,fun){ this。乐趣=乐趣;if(typeof(id)!=' object ')id=a . $(id);this . obj=id var w=a . wz(id);var ph=文档。文档元素。客户高度,pw=文件。文档元素。客户端宽度;var sh=文档。文档元素。滚动顶部,SW=文档。文档元素。滚动字母;if(w . x-SW 322 pw){ var l=w . x id。偏移量为-322;} else { var l=w.x} if(w . y-sh 329 id。偏置右ph){ var t=w . y-329;} else { var t=w . y id。偏移光线;}带(a . $(“颜色女士”).style){ display=' block ';top=t ' pxleft=l ' px } } t . hide=function(){ a . $(' ms color ')。风格。显示='无';}T.e=['0 ',' 1 ',' 2 ',' 3 ',' 4 ',' 5 ',' 6 ',' 7 ',' 8 ',' 9 ',' A ',' B ',' C ',' D ',' E ',' F '];T.f=函数(a){ t . h=a;t . c . innerHTMl=if(a==7){ for(var I=0;i16I){ var s=a . $ $(' span ');标题=风格。背景色=' # ' t . e[I]t . e[I]t . e[I]t . e[I]t . e[I]t . e[I];t . c .阑尾;} T.g(a,0);} else { for(var I=0;i16I){ var s=a . $ $(' span ');标题=风格。background COlOr=t . z(a,t . e[I]);t . c .阑尾;s . onclick=function(){ var s=this。标题。substr(1,1);if(s==' 0 ')s=this。标题。substr(3,1);if(s==' 0 ')s=this。标题。substr(5,1);T.g(T.h,s);} } T.g(a,0);} } T.g=函数(a,b){ t . d . inner html=' ';开关(parsent(a)){案例1: var c=3,e=5,g='t.z(a,b,c,t.e[parseint(i/16)],e,t.e[i])';打破;案例3: var c=1,e=5,g='t.z(c,t.e[parseint(i/16)],a,b,e,t.e[i])';打破;案例5: var c=1,e=3,g='t.z(c,t.e[parseint(i/16)],e,t.e[i],a,b)';打破;案例7:为(var I=0;i256I){ var s=文档。创建元素(“span”);标题=风格。背景色=' t . e[par . sent(i/16)]t.e[i]t . e][par . sent(i/16)]t.e[i]t . e[par . sent(i/16)]t.e[i];s . onmouseover=function(){ t . a . value=this。标题;t . b .风格。背景色=这个。风格。背景颜色;标题=这个。标题;} s . onclick=function(){ t . hide();有趣(这个标题,t . obj);} t . d . appendchild}返回错误的打破;} for(var I=0;i256I){ var s=文档。创建元素(“span”);标题=风格。background COlOr=eval(g);s . onmouseover=function(){ t . b . style。背景颜色=这个。风格。背景颜色;t . a .值=这个。标题;标题=这个。标题;} s . onclick=function(){ t . hide();有趣(这个标题,t . obj);} t . d . appendchild} } t . b . onclick=function(){ t . hide();有趣(这个标题,t . obj);} t . a . onkeyup=function(e){ var e=e | | event;if(e . KeyCode==13){ t . b . style。背景颜色=这个。价值;标题=这个。价值;t . hide();T.fun(this.value,t . obj);} } T.z=函数(a、b、c、d、e、f){ s=' # ';a=ParSeint(a);c=ParSeint(c);e=ParSeint(e);for(var I=0;i6;I){ if(I=(a-1)I(a 1)){ s=b;}否则if(I=(c-1)I(c 1)){ s=d;}否则if(I=(e-1)I(e 1)){ s=f;} else { s=' 0} }返回s;} t . f(1);运行效果图如下:

希望本文所述对大家的爪哇岛描述语言程序设计有所帮助。

更多资讯
游戏推荐
更多+