Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/11/2011, 09:47
Avatar de livemusic
livemusic
 
Fecha de Ingreso: abril-2011
Ubicación: Lima - Chorrillos
Mensajes: 150
Antigüedad: 13 años
Puntos: 18
Respuesta: ¿Como pasar valor desde 'onclick' a la función?

Hola, mira io lo trabajo de la siguiente manera, y de seguro te va a servir ... mando el id atraves del rel... como puedes ver .

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=utf-8" />
  4. <title>Documento sin título</title>
  5. <script src="http://www.google.com/jsapi"></script>  
  6. <script type="text/javascript">
  7. google.load("jquery", "1.6.2");
  8. <script type="text/javascript">
  9. $(function(){
  10.     $(".delt").unbind("click").click(function(e){
  11.         var id = $(this).attr("rel");
  12.         alert(id);
  13.         //eliminar(id);
  14.         e.preventDefault();
  15.     })
  16. })
  17.  
  18. function eliminar(id) {
  19.     Sexy.confirm('<h1>Eliminar</h1> ¿Seguro que quieres eliminar?' ,{ onComplete:
  20.       function(returnvalue) {
  21.         if(returnvalue)
  22.         {
  23.           window.location.href = "../ruta/index.php?eliminar="+id;
  24.         }
  25.       }
  26.     });
  27. }</script>
  28. </head>
  29.  
  30.     <tr>
  31.         <th>Id</th>
  32.         <th>Nick</th>
  33.     </tr>
  34.     <tbody>
  35.         <tr>
  36.             <td><a class="delt" href="#" rel="1">1</a></td>
  37.             <td>~PowerCarito</td>
  38.         </tr>
  39.         <tr>
  40.             <td><a class="delt" href="#" rel="2">2</a></td>
  41.             <td>LiveMusic</td>
  42.         </tr>
  43.         <tr>
  44.             <td><a class="delt" href="#" rel="3">3</a></td>
  45.             <td>LiveMusic && LiveCarito</td>
  46.        </tr>
  47.    </tbody>
  48. </table>
  49. </body>
  50. </html>

... suerte saludoooosss ¡¡............