今天小编给大家分享一下id是html的属性吗的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一
顺晟科技
2021-06-16 10:31:55
303
本篇文章给大家带来的内容是关于(超好用)html颜色选择器的用法,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
@*以下是测试超文本标记语言颜色选择器的*@
@*ahref='#'mce_href='# '
onclick='initColorPicker '(演示');returnfalse'id='demo '
style=' position : absolute ' left :200 px '颜色选择/a*@
!-颜色选择器-
@*scripttype='text/JavaScript '
varcolorPicker=函数(idStr){
this.colorPool=['#000000 ',' #993300 ',' #333300 ',
'#003300','#003366','#000080','#333399','#333333','#800000',
#FF6600 ',' #808000 ',' #008000 ',' #008080 ',' #0000FF ',' #666699 ',
#808080 ',' #FF0000 ',' #FF9900 ',' #99CC00 ',' #339966 ',' # 33CCCC ',
#3366FF ',' #800080 ',' #999999 ',' #FF00FF ',' #FFCC00 ',' #FFFF00 ',
#00FF00 ',' #00FFFF ',' #00CCFF ',' #993366 ',' #CCCCCC ',' #FF99CC ',
#FFCC99 ',' #FFFF99 ',' #CCFFCC ',' #CCFFFF ',' #99CCFF ',' #CC99FF ',
# FFFFFF '];
这个。初始化(IDstr);
}
colorPicker.prototype={
初始化:函数(IDstr){
var count=0;
varhtml=
varself=this
html='表格单元格间距=' 5 '单元格填充=' 0 '
边框='2'bordercolor='#000000 '
style=' cursor:pointer背景' :#ECE9D8 '
MCE _ style=' cursor : pointerbackground : # ECE9D 8 " ";
//html=' TRT align=' center ' colspan=' 8 ' width=' 160 '
高度='20'id='currentColor '
bgcolor='#ffffff '当前颜色/TD/tr ';
for(I=0;i5;i ){
html=' tr
for(j=0;j8;j ){
html=' TD align=' center ' width=' 20 '
高度=' 20 '样式='背景: '这个。颜色池[计数]' '
MCE _ style=' background : '这个。颜色池[计数]' '
不可选择=' on '/TD ';
计数;
}
html='/tr ';
}
html='/table ';
这个。trigger=文档。getelementbyid(IDstr);
这个。p=文档。create ElEMENT(' p ');
这个。p . InnerHTML=html
var TDS=这个。p . GetElementsBytagName(' TD ');
for(vari=0,l=tds.lengthili ){
tds[i].onclick=function(){
自我。SetColor(这个。风格。背景色,IDstr);
}
}
这个。p . id=' MyColoPicker
这个。扳机。ParentNode。appendchild(这个。p);
这个。p . style。位置='';
这个。p . style。左=这个。扳机。offsetleft ' px '
这个。p . style。top=(这个。扳机。客户高度。扳机。offset top)' px ';
//这个。hide();
这个。扳机。onclick=function(){
if(self。p . style。display==' none '){
自我。show();
returnfalse
}else{
自我。hide();
returnfalse
}
}
},
setColor:function(c,idStr){
这个。hide();
//文档。getelementbyid(IDstr)。风格。背景色=c//proeditor。setColor(c);//自己定义函数决定塞迪千图的功能
文件。GetElementbyID(IDstr)。风格。颜色=c
//varrg B2 hex=color gb2 hex(c);
//alert(RGB2hex);
},
hide:function(){
this.p.style.display='none '
},
show:function(){
this.p.style.display='block '
}
}
functioninitcolorbicker(str){
picker=NewColorPicker(str);
}
functioncolorRGB2Hex(颜色){
varrgb=color.split(',');
varr=parseInt(rgb[0]).split('(')[1]);
varg=Parseint(RGB[1]);
varb=parseInt(rgb[2]).split(')')[0]);
varhex='#' ((124) (r16) (g8) b).toString(16).切片(1);
returnhex
}
/脚本*@
19
2022-10
19
2022-10
18
2022-10
02
2022-10
02
2022-10
02
2022-10