Guest User

Untitled

a guest
May 27th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <html>
  2. <head>
  3. <?php
  4.  
  5. $filas = 4;
  6. $columnas = 4;
  7. $texto = 0;
  8. $grey = true;
  9. ?>
  10. </head>
  11. <body>
  12.  
  13. <!-- Creamos el inicio de la tabla manualmente-->
  14. <table border="1">
  15. <?php
  16. //Iniciamos el bucle de las filas
  17. for($t=0;$t<$filas;$t++){
  18. echo "<tr>";
  19.  
  20. //Iniciamos el bucle de las columnas
  21. for($y=0;$y<$columnas;$y++){
  22. if($grey){
  23. //Pintamos el cuadro
  24. echo "<td style=padding:3px;
  25. background-color:#F5D0A9;>".$texto."</td>";
  26. //El próximo no será pintado
  27. $grey=false;
  28. $texto++;
  29. }else{
  30. //Dejamos cuadro en blanco
  31. echo "<td style=padding:3px;>".$texto."</td>";
  32. //El próximo será pintado
  33. $grey=true;
  34. $texto++;
  35. }
  36. }
  37. //Cerramos columna
  38. echo "</tr>";
  39. }
  40. ?>
  41. <!-- Cerramos tabla -->
  42. </table>
  43. </body>
  44. </html>
Add Comment
Please, Sign In to add comment