⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftb.colorpicker.aspx

📁 数据库设计2.页面的设计与开发3.小结第8章在线考试系统 161 实例分析 161 1. 系统设计2.系统功能预览知识要点 167 制作步骤 168 1 ... 利用简单的HTML代码与脚本 融合而成
💻 ASPX
字号:
<%@ Page language="c#" %>
<html>
<head>
<title>拾色器</title>
<style>
.cc {
	width:10;height:8;
}
</style>
<script launguage="JavaScript">
function colorOver(theTD) {
	previewColor(theTD.style.backgroundColor);
	setTextField(theTD.style.backgroundColor);
}
function colorClick(theTD) {
	setTextField(theTD.style.backgroundColor);
	returnColor(theTD.style.backgroundColor);
}
function setTextField(ColorString) {
	document.getElementById("ColorText").value = ColorString.toUpperCase();
}
function returnColor(ColorString) {
	window.returnValue = ColorString;
	window.close();	
}		
function userInput(theinput) {
	previewColor(theinput.value);
}
function previewColor(theColor) {
	try {
		PreviewDiv.style.backgroundColor = theColor;
	} catch (e) {
	}
}
</script>		
</head>

<body style="background-color:d4d0c8; margin: 2 2 2 2;">
<form runat="server">

<table cellpadding=0 cellspacing=0 border=0>
<tr><td colspan=3>
	<asp:Literal id="Colors" 
		runat="server" EnableViewState="false" />
</td></tr>
<tr>	
	<td><input type="text" name="ColorText" id="ColorText" style="width:60;height:22;" onkeyup="userInput(this);"></td>
	<td align=center><div id="PreviewDiv" style="width:50;height:20;border: 1 solid black; background-color: #ffffff;">&nbsp;</div></td>
	<td align=right><input type="button" value="确定" onclick="returnColor(ColorText.value);" id="ColorButton"  style="width:80;"></td>
</tr>
</table>

</form>
</body>
</html>
<script language="c#" runat="server">
private void Page_Load(object sender, System.EventArgs e) {
	int onrow=1;
	int oncol=1;
	int count=1;
	string s ="";
	string set1 = "";
	string set2 = "";
	for (int r=5; r>=0; r--) {
		for (int g=5; g>=0; g--) {
			for (int b=5; b>=0; b--) {
				if (oncol==1) s += "<tr>\n";
				s += "\t<td onmouseover=\"colorOver(this);\" onclick=\"colorClick(this);\" style=\"background-color:"+ReturnHex(r)+ReturnHex(g)+ReturnHex(b)+";\" class=cc></td>\n";
				oncol++;
				if (oncol >= 19) {
					s+="</tr>\n";
					oncol = 1;
					
					if (onrow % 2 == 0) {
						set2 += s;
					} else {
						set1 += s;
					}
					s = "";
					onrow++;
				}				
				count++;
			}
		}
	}
	Colors.Text = "<table cellpadding=0 cellspacing=1 style=\"background-color:ffffff;\" border=0 >" + set1 + set2 + "</table>";
}

string ReturnHex(int i) {
	switch (i) {
		default:
		case 0:
			return "00";
		case 1:
			return "33";
		case 2:
			return "66";
		case 3:
			return "99";			
		case 4:
			return "CC";
		case 5:
			return "FF";			
	}
}
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -