Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/04/2012, 07:53
Avatar de zerokilled
zerokilled
Javascripter
 
Fecha de Ingreso: abril-2009
Ubicación: Isla del Encanto, La Borinqueña [+>==]
Mensajes: 8.050
Antigüedad: 15 años
Puntos: 1485
Respuesta: Como puedo hacer esta paleta de colores

@richi1234,
¿no se te ocurrio ver el código fuente del enlace inicial? ¡además, con lo fácil que es ensamblar un prototipo, más los varios ejemplos que puedes encontrar por la web! este un ejemplo que había escrito hace ya un tiempo.

nota: presta atención a las fechas y avisos de los temas. este tema es del 2010. si el tema es antiguo, crea un nuevo tema haciendo referencia al tema que tienes duda.

Código:
<html>
<head><title>WebSafe Palette Color</title>
<script type='text/javascript'>
function webSafe(){
var r,g,b,rgb = ['00', '33', '66', '99', 'CC', 'FF'];
var tellcolor = document.getElementById('tellColor'), table = document.body.appendChild(document.createElement('table'));
for(var i = 0; i < rgb.length; i++){
r = rgb[i];
var tbody = table.appendChild(document.createElement('tbody'));
	for(var j = 0; j < rgb.length; j++){
	g = rgb[j];
	var tr = tbody.appendChild(document.createElement('tr'));
		for(var k = 0; k < rgb.length; k++){
		b = rgb[k];
		var td =  tr.appendChild(document.createElement('td'));
		td.style.backgroundColor = '#' + r + g + b;
		td.appendChild(document.createTextNode(r + g + b));
		}
	}
} //end for;

	table.onclick = function(evt){
	document.body.style.backgroundColor = evt.target.style.backgroundColor;
	tellcolor.innerHTML = evt.target.innerHTML;
	};
} //end webSafe;
onload = webSafe;
</script>
<style type='text/css'>
body{
text-align:center;
}

table{
margin:auto;
width:375px;
}

tbody{
margin:25px;
}

td{
padding:5px;
font-family: monospace;
}

p{
background:#FFF;
color:#000;
padding:1em;
width:15em;
margin:auto;
}
</style></head>

<body><p>Current Color: <span id='tellColor'>rgb(,,)</span></p>
</body></html>
__________________
la maldad es una virtud humana,
y la espiritualidad es la lucha del hombre contra su maldad.