Ver Mensaje Individual
  #4 (permalink)  
Antiguo 21/04/2013, 22:02
Avatar de David
David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: Cambio de Color de una celda en un formulario

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <html lang="es">
  3.     <head>
  4.         <title>Ejemplo</title>
  5.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6.         <script type="text/javascript">
  7.             window.onload = function() {
  8.                 document.getElementById("colorselect").onchange = function() {
  9.                     document.getElementById("parrafo").style.backgroundColor = this.value;
  10.                 }
  11.             };
  12.         </script>
  13.     </head>
  14.     <body>
  15.         <h1>Color</h1>
  16.         <form method="get">
  17.             <div>
  18.                 <select name="color" id="colorselect">
  19.                     <option value="#fff">Blanco</option>
  20.                     <option value="#000">Negro</option>
  21.                     <option value="#ff0000">Rojo</option>
  22.                 </select>
  23.             </div>
  24.             <p id="parrafo">
  25.                 Esto cambia de color
  26.             </p>
  27.     </body>
  28. </html>
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.