Location: PHPKode > projects > ToplistHost > toplisthost/colortable/color2.html
<HTML>
<HEAD>
<TITLE>Farbpalette</TITLE>
<style type="text/css">
<!--
#subtext { font-family:helvetica,arial; font-size:8pt; background-color:#CCCCCC; layer-background-color:#CCCCCC;}
#title { font-family:helvetica,arial; font-size:13pt; font-weight:bold; }

#display { position:absolute; left:125; top:24; width:32px; height:114px; z-index:1; visibility:visible; background-color:#000000; layer-background-color:#000000; }
#hexValue { position:absolute; left:0; top:24; width:125; height:115; z-index:1; visibility:visible;}
#titleBar { position:absolute; left:0; top:0; width:155; height:20; z-index:1; background-color:#DDDDDD; layer-background-color:#DDDDDD;}
#colorTable { position:absolute; left:160; top:3; width:320; height:200; z-index:1; visibility:visible;}
//-->
</style>
<script>
focus();
var hexArray = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
var ns6;

function sendback(string) {
	window.opener.feld.value=string;
	window.opener.change(window.opener.feld2, string);
}	
</script>
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function init() {
ns4 = (document.layers)?true:false;
ie4 = (document.all)?true:false;
if((document.getElementById) && !(document.all)) ns6=1;
rValue=0;
gValue=0;
bValue=0;
r1 = '0';
r2 = '0';
g1 = '0';
g2 = '0';
b1 = '0';
b2 = '0';
Rgb = '0';
rGb = '0';
rgB = '0';
if (ns4) {
	domDisplay = document.display;
	domValue = document.hexValue.document.frmValue.valueDisp;
	domredValue = document.hexValue.document.frmValue.RgbDisp;
	domgreenValue = document.hexValue.document.frmValue.rGbDisp;
	domblueValue = document.hexValue.document.frmValue.rgBDisp;
} else if(ns6) {
	domDisplay = document.getElementById("display");
	domValue = document.getElementById("valueDisp");
	domredValue = document.getElementById("RgbDisp");
	domgreenValue = document.getElementById("rGbDisp");
	domblueValue = document.getElementById("rgBDisp");
} else {
	domDisplay = display;
	domValue = frmValue.valueDisp;
	domredValue = frmValue.RgbDisp;
	domgreenValue = frmValue.rGbDisp;
	domblueValue = frmValue.rgBDisp;
}
}


function calcValue(base, color) {
base -= 1;
if (base < 16) { first = 0; }
else { first = parseInt(base/16); }
if (base < 0 ) { second = 0; base = 0; }
else { second = parseInt(base%16); }
c1=hexArray[first];
c2=hexArray[second]; 
if (color == 'red') { r1 = c1; r2 = c2; Rgb=base; }
else if (color == 'green') { g1 = c1; g2 = c2; rGb=base; }
else { b1 = c1; b2 = c2; rgB=base; }
domValue.value = eval('"'+r1+r2+g1+g2+b1+b2+'"');
domredValue.value = eval('"'+Rgb+'"');
domgreenValue.value = eval('"'+rGb+'"');
domblueValue.value = eval('"'+rgB+'"');
sendback(eval('"#'+r1+r2+g1+g2+b1+b2+'"'));
if (ns4) { domDisplay.bgColor = eval('"#'+r1+r2+g1+g2+b1+b2+'"'); }
else { domDisplay.style.backgroundColor = eval('"#'+r1+r2+g1+g2+b1+b2+'"'); }
return true;
}

function manualSet(value,color) {
if (value < 0) value=0;
if (value > 255) value=255;
++value;
calcValue(value,color);
}

function convertHex(hexString) {
if(hexString == null) hexString = domValue.value;
inputHexArray = new Array(6);
for(i=0;i<=5;++i) {
inputHexArray[i] = hexString.charAt(i);
}
for(i=0;i<=5;++i) {
tempHexVal = inputHexArray[i];
for(j=0;j<=15;++j) {
if(tempHexVal == hexArray[j]) tempHexVal = j;
}
inputHexArray[i] = tempHexVal;
}
Rgb = (inputHexArray[0]*16)+inputHexArray[1]+1;
calcValue(Rgb,'red');
rGb = (inputHexArray[2]*16)+inputHexArray[3]+1;
calcValue(rGb,'green');
rgB = (inputHexArray[4]*16)+inputHexArray[5]+1;
calcValue(rgB,'blue');
}
// End -->
</script>
</HEAD>

<BODY BGCOLOR=#ffffff vlink=#0000ff OnLoad="init()">

<div id="colorTable">
<table border=0 cellpadding=0 cellspacing=1>
<script>
<!--
clr = new Array('00','33','66','99','CC','FF');

for(k=0;k<6;++k){
for(j=0;j<6;){
document.write('<tr>\n');
for(m=0;m<3;++m){
for(i=0;i<6;++i){
document.write('<td width=10 height=10 bgcolor=#'+clr[k]+clr[j+m]+clr[i]+'>');
document.write('<a href="javascript:void(0)" ');
document.write('onClick="convertHex(\''+clr[k]+clr[j+m]+clr[i]+'\')\;">');
document.write('<img src="../admin/img/spacer.gif" width=10 height=10 border=0></a></td>\n');
}
}
document.write('<td width=10 height=10 bgcolor=#'+clr[k]+clr[k]+clr[k]+'>');
document.write('<a href="javascript:void(0)" ');
document.write('onClick="convertHex(\''+clr[k]+clr[k]+clr[k]+'\')\;">');
document.write('<img src="../admin/img/spacer.gif" width=10 height=10 border=0></a></td>\n');
j+=3;
document.write('</tr>\n');
}
}
//-->
</script>
</table>
</div>
<div id="display"><img src="../admin/img/spacer.gif" width=30 height=112 border=1></div>
<div id="titleBar">
<table border=0 cellpadding=2 cellspacing=0 width=120>
<tr>
<td id="title">Farbe wählen</td>
</tr>
</table>
</div>
<div id="hexValue"><form name="frmValue">
<table border=0 cellpadding=2 cellspacing=0 bgcolor=#EEEEEE>
<tr><td id="subtext">Red</td><td><input type=text size=3 maxlength=3 name="RgbDisp" id="RgbDisp" value="0" onBlur="manualSet(this.value,'red');"></td></tr>
<tr><td id="subtext">Green</td><td><input type=text size=3 maxlength=3 name="rGbDisp" id="rGbDisp" value="0" onBlur="manualSet(this.value,'green');"></td></tr>
<tr><td id="subtext">Blue</td><td><input type=text size=3 maxlength=3 name="rgBDisp" id="rgBDisp" value="0" onBlur="manualSet(this.value,'blue');"></td>
</tr>
<tr>
<td id="subtext">Hexdecimal</td>
<td><input type=text size=6 maxlength=6 name="valueDisp" id="valueDisp" value="000000" onBlur="convertHex();"></td>
</tr>

</table>
</form>
</div>
</body>
</html>
Return current item: ToplistHost