Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/01/2013, 09:28
carlosuc99
 
Fecha de Ingreso: junio-2011
Mensajes: 342
Antigüedad: 12 años, 10 meses
Puntos: 5
Exclamación Problema con bucle y dialog JQuery

Buenas,

Tengo esto:

Código Javascript:
Ver original
  1. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
  2.     if($i++%2==0){
  3.        $color="#FFFFFF";
  4.     }else{
  5.        $color="#CCCCCC";
  6.     }
  7.  
  8.     ?>
  9.  
  10.     <tr bgcolor='<?php echo $color; ?>' onmouseover="this.style.background='#ABFB04';" onmouseout="this.style.background='<?php echo $color; ?>';">
  11.     <?php
  12.  
  13. echo "<td class=tablelist>";
  14.  
  15. echo $row["ICAO"] . '</td><td class=tablelist>';
  16.  
  17. echo $row["Name"] . '</td><td class=tablelist>';
  18.  
  19. echo $row["WeightEmpty"] . '</td><td class=tablelist>';
  20.  
  21. echo $row["WeightFull"] . '</td><td class=tablelist>';
  22.  
  23. echo $row["CargoFull"] . '</td><td class=tablelist>';
  24.  
  25. echo $row["Range"] . '</td><td class=tablelist>';
  26.  
  27. echo $row["Price"] . '</td><td class=tablelist>';
  28.  
  29. echo $row["FirstClassSeats"] . '</td><td class=tablelist>';
  30.  
  31. echo $row["BusinessClassSeats"] . '</td><td class=tablelist>';
  32.  
  33. echo $row["EconomyClassSeats"]. '</td><td class=tablelist>';
  34.  
  35. echo "<img id='editaircraft' src='./images/info.png'></td></tr>";
  36.  
  37. ?>
  38. <script>
  39.     $(function() {
  40.         $( "#editaircraftdialog" ).dialog({
  41.             autoOpen: false,
  42.             width: 425
  43.         });
  44.  
  45.         $( "#editaircraft" ).click(function() {
  46.             $( "#editaircraftdialog" ).dialog( "open" );
  47.             return false;
  48.         });
  49.     });
  50. </script>
  51.  
  52. <div id="editaircraftdialog" title="Edit Aircraft">
  53.     <p>Hello World!!</p>
  54. </div>
  55.  
  56. <?php
  57. }
  58.  
  59. echo "</table>";
  60. $pagination->render();
  61. ?>

Es un bucle creado con un while. Pertenece al contenido de una tabla. Quiero que al pulsar la imagen info.png en cualquiera de las filas de la tabla se me despliegue el dialog que "editaircraftdialog".

Con el código de arriba el dialog sólo se despliega en la primera fila, por lo tanto interpreto que solo funciona la 1era vez que se ejecuta el while.