Tema: Colores
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/11/2006, 11:32
Avatar de JavierB
JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 23 años
Puntos: 772
Hola imagenarte

A ver si esto te sirve de ayuda:
Código:
<html>
<head>
<script type="text/javascript">
function convertir(obj) {
  num = obj.value;
  if (isNaN(num) || num<0 || num>255)
    return;
  valor = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']
  n1 = Math.floor(num / 16);
  n2 = num % 16;
  obj.value = valor[n1]+valor[n2];
}
</script>
</head>
<body>
Número de 0 a 255 <input type="text" onblur="convertir(this)" />
</body>
</html>
Saludos,