浮动网页调色板(js)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
名称:调色版
制作:石卓林
QQ:383193853
url:http://www.my586.com
mail:szl1982szl@163.com
时间:2005/06/02 22:54
使用说明:
用事件调用 
select_color(\'需要设置的属性1|需要设置的属性2|需要设置的属性3\')
例:
onClick="javascript:select_color('this.document.all.text0.value|this.document.all.text1.value')
*/
function color_select(){
var Num16_str = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');//十六进制字符串
var Num16;//用于包存十六进制的颜色
var i_1,i_2,i_3;//定义六个的变量用于保存十六进制数
var i=3;//定义颜色步进不可修改
var num=0;
var w = 16;//定义单元格宽度
var h = 16;//定义单元格高度
var html = '';
    html += ' ';
    html += ' ';
    html += '';
    html += ' ';
    html += ' ';
    html += '
<table border="1" cellspacing="0" cellpadding="0" bgcolor="#ECE9D8">
<tbody>
<tr>
<td>'; html += '
'; html += ' '; html += ' '; html += '
ColorCode '; html += '
JC调色板Ver1.0 '; html += ' '; html += '
<table border="1" width="100%" cellspacing="3" cellpadding="0" align="center">
<tbody>
<tr>
<td id="show_color_test" width="33%"></td>
</tr>
</tbody>
</table>
'; html += '</td>
</tr>
<tr>
<td>'; html += '
'; //定义输出 for(i_1=0;i_1&lt;16;i_1+=i){ for(i_2=0;i_2&lt;16;i_2+=i){ for(i_3=0;i_3&lt;16;i_3+=i){ //生成十六进制颜色代码 Num16 = '#' + Num16_str[i_1] + Num16_str[i_1] + Num16_str[i_2] + Num16_str[i_2] + Num16_str[i_3] + Num16_str[i_3]; Num16 = ' ' if(num % 18 == 0){ html += '
' + Num16; }else{ html += Num16; } num++; } } } html += '
<table style="cursor: hand;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td bgcolor=" + Num16 + " width=" + w + " height=" + h + "></td>
</tr>
</tbody>
</table>
'; html += '</td>
</tr>
</tbody>
</table>
'; return html; } function select_yes(str){ this.document.all.color_Layer_1.style.visibility = 'hidden';//隐藏取色器 if(str!=false){ object_str = object_str.split('|');//设置要赋值的属性 for(var i=0;i&lt;str.length;i++){ eval(object_str[i]+'= str');//赋值给预定对象 } } } function select_color(name){ if(name ==null){ alert('调用select_color错误\n正确格式\nselect_color(\'需要设置的属性1|需要设置的属性2|需要设置的属性3\')\n例:\nonClick="javascript:select_color(\'this.document.all.text.value\')');//错误提示信息 }else{ if(select_color_ok != true){//判断是否第一次启动取色器 this.document.all.color_Layer_1.innerHTML = color_select();//让取色器根据对象id显示新的内容 select_color_ok = true;//设置已经使用的标志 } this.document.all.color_Layer_1.style.posTop=event.clientY+this.document.body.scrollTop;//设置y坐标 this.document.all.color_Layer_1.style.posLeft=event.clientX+this.document.body.scrollLeft;//设置x坐标 this.document.all.color_Layer_1.style.visibility = '';//显示取色器 object_str = name;//设置取值对象 } } //写代码显示层 this.document.write('
<div id="color_Layer_1" style="position: absolute; visibility: hidden;"></div>
'); var select_color_ok = false;//初始化使用标志 var object_str;//设置变量用于保存目标值属性的字符串

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.

Proudly powered by WordPress   Premium Style Theme by www.gopiplus.com