Ver Mensaje Individual
  #2 (permalink)  
Antiguo 26/03/2011, 11:13
Avatar de abimaelrc
abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 15 años
Puntos: 1517
Respuesta: Aporte Personaliza el color de tu pagina

En estos casos te recomiendo que mejor uses javascript, porque estás haciendo una petición que si la persona quiere refrescar la pantalla le va a molestar porque tiene que enviar la petición nuevamente o usar el método de GET.

Con javascript
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  4. <title>Documento sin t&iacute;tulo</title>
  5. </head>
  6.  
  7.  
  8. <table width="120" border="0" cellspacing="0" cellpadding="0">
  9.   <tr>
  10.     <td width="30" bgcolor="#0000FF"><a href="javascript: document.body.style.backgroundColor='#0000ff'">Azul</a></td>
  11.     <td width="30" bgcolor="#ff0000"><a href="javascript: document.body.style.backgroundColor='#ff0000'">Rojo</a></td>
  12.     <td width="30" bgcolor="#00ff00"><a href="javascript: document.body.style.backgroundColor='#00ff00'">Verde</a></td>
  13.     <td width="30" bgcolor="#ffffff"><a href="javascript: document.body.style.backgroundColor='#ffffff'">Blanco</a></td>
  14.     <td width="30" bgcolor="#000000"><a href="javascript: document.body.style.backgroundColor='#000000'">Negro</a></td>
  15.   </tr>
  16. <br />
  17. </body>
  18. </html>

con el método de GET
Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Documento sin t&iacute;tulo</title>
  6. <style>
  7. body{
  8.     background-color: #<?php echo array_key_exists('color', $_GET) ? $_GET['color'] : 'ffffff'; ?>
  9. }
  10. </style>
  11. </head>
  12.  
  13. <body>
  14.  
  15. <table width="120" border="0" cellspacing="0" cellpadding="0">
  16.   <tr>
  17.     <td width="30" bgcolor="#0000FF"><a href="?color=0000ff">Azul</a></td>
  18.     <td width="30" bgcolor="#ff0000"><a href="?color=ff0000">Rojo</a></td>
  19.     <td width="30" bgcolor="#00ff00"><a href="?color=00ff00">Verde</a></td>
  20.     <td width="30" bgcolor="#ffffff"><a href="?color=ffffff">Blanco</a></td>
  21.     <td width="30" bgcolor="#000000"><a href="?color=000000">Negro</a></td>
  22.   </tr>
  23. </table>
  24. <br />
  25. </body>
  26. </html>
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos