温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:小范企业管理源码
当前文件路径:XiaoFanWeb/FTB_1.6.3_zh/HelperScripts/ftb.colorpicker.aspx

1<%@ Page language="c#" %> 2
<html> 3
<head> 4
<title>拾色器</title> 5
<style> 6
.cc { 7
width:10;height:8; 8
} 9
</style> 10
<script launguage="JavaScript"> 11
function colorOver(theTD) { 12
previewColor(theTD.style.backgroundColor); 13
setTextField(theTD.style.backgroundColor); 14
} 15
function colorClick(theTD) { 16
setTextField(theTD.style.backgroundColor); 17
returnColor(theTD.style.backgroundColor); 18
} 19
function setTextField(ColorString) { 20
document.getElementById("ColorText").value = ColorString.toUpperCase(); 21
} 22
function returnColor(ColorString) { 23
window.returnValue = ColorString; 24
window.close(); 25
} 26
function userInput(theinput) { 27
previewColor(theinput.value); 28
} 29
function previewColor(theColor) { 30
try { 31
PreviewDiv.style.backgroundColor = theColor; 32
} catch (e) { 33
} 34
} 35
</script> 36
</head> 37
38
<body style="background-color:d4d0c8; margin: 2 2 2 2;"> 39
<form runat="server"> 40
41
<table cellpadding=0 cellspacing=0 border=0> 42
<tr><td colspan=3> 43
<asp:Literal id="Colors" 44
runat="server" EnableViewState="false" /> 45
</td></tr> 46
<tr> 47
<td><input type="text" name="ColorText" id="ColorText" style="width:60;height:22;" onkeyup="userInput(this);"></td> 48
<td align=center><div id="PreviewDiv" style="width:50;height:20;border: 1 solid black; background-color: #ffffff;"> </div></td> 49
<td align=right><input type="button" value="确定" onclick="returnColor(ColorText.value);" id="ColorButton" style="width:80;"></td> 50
</tr> 51
</table> 52
53
</form> 54
</body> 55
</html> 56
<script language="c#" runat="server"> 57
private void Page_Load(object sender, System.EventArgs e) { 58
int onrow=1; 59
int oncol=1; 60
int count=1; 61
string s =""; 62
string set1 = ""; 63
string set2 = ""; 64
for (int r=5; r>=0; r--) { 65
for (int g=5; g>=0; g--) { 66
for (int b=5; b>=0; b--) { 67
if (oncol==1) s += "<tr>\n"; 68
s += "\t<td onmouseover=\"colorOver(this);\" onclick=\"colorClick(this);\" style=\"background-color:"+ReturnHex(r)+ReturnHex(g)+ReturnHex(b)+";\" class=cc></td>\n"; 69
oncol++; 70
if (oncol >= 19) { 71
s+="</tr>\n"; 72
oncol = 1; 73
74
if (onrow % 2 == 0) { 75
set2 += s; 76
} else { 77
set1 += s; 78
} 79
s = ""; 80
onrow++; 81
} 82
count++; 83
} 84
} 85
} 86
Colors.Text = "<table cellpadding=0 cellspacing=1 style=\"background-color:ffffff;\" border=0 >" + set1 + set2 + "</table>"; 87
} 88
89
string ReturnHex(int i) { 90
switch (i) { 91
default: 92
case 0: 93
return "00"; 94
case 1: 95
return "33"; 96
case 2: 97
return "66"; 98
case 3: 99
return "99"; 100
case 4: 101
return "CC"; 102
case 5: 103
return "FF"; 104
} 105
} 106
</script> 107





.cc
width
}