Guest User

Untitled

a guest
Nov 16th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. <style type="text/css">
  2. @charset "utf-8";
  3. .castle_array {
  4.     width: 128px;
  5.     height: 128px;
  6.     background-color: #6C0;
  7.     float: left;
  8. }
  9. .castle_array:hover {
  10.     background-color: #6F0;
  11.     float: left;
  12. }
  13. .clear_both {
  14.     clear: both;
  15. }
  16. </style>
  17.  
  18. <script type="text/javascript">
  19. function B_modeWindow () {
  20.     alert(this.id);
  21. }
  22. </script>
  23.  
  24. <?php
  25. $id = '1';
  26.  
  27. include_once 'include_once/connect.php';
  28.  
  29. for ($x = 1; $x <= 5; $x++) {
  30. for ($y = 1; $y <= 5; $y++) {
  31. $xy = $x."x".$y;
  32.     $pullMapInfo = "SELECT value FROM mapinfo WHERE id='".$id."' AND xy='".$xy."'";
  33.     $pullMapInfo2 = mysql_query($pullMapInfo) or die('error here');
  34.    
  35.     if ($pullMapInfo3 = mysql_fetch_array($pullMapInfo2)) {
  36.         echo '<div class="castle_array" style="background-image: url(tiles/'.$pullMapInfo3[0].'.BMP)" id="'.$x.'x'.$y.'">'. $pullMapInfo3[0] .'</div>';
  37.     } else {
  38.         echo '<div class="castle_array" id="'.$xy.'"></div>';
  39.     }
  40. }
  41. echo '<div class="clear_both"></div>';
  42. }
  43.  
  44. ?>
  45.  
  46. <script type="text/javascript">
  47. for (x = 1; x <= 5; x++) {
  48. for (y = 1; y <= 5; y++) {
  49.     document.getElementById(x+"x"+y).addEventListener("click",B_modeWindow);
  50. }
  51. }
Add Comment
Please, Sign In to add comment