Ver Mensaje Individual
  #4 (permalink)  
Antiguo 13/08/2012, 09:20
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: borrar contenido

Con un poquito de css lo conseguís
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title> Borrar filas de tabla </title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6.  
  7. <style type="text/css">
  8. /*<![CDATA[*/
  9. .borrar{
  10. visibility: hidden;
  11. }
  12. #tablaDatos tr:hover .borrar{
  13. visibility: visible;
  14. }
  15.  
  16. /*]]>*/
  17. <script type="text/javascript">
  18.     //<![CDATA[
  19. function borrarFila(f){
  20. var i=f.parentNode.parentNode.rowIndex;document.getElementById('tablaDatos').deleteRow(i);
  21. }
  22.  //]]>
  23. </head>
  24.  
  25. <table id="tablaDatos" border="1" width="40%">
  26. <tr>
  27.   <th align="left" width="60%">Nombre</th>
  28.   <th width="40%">&nbsp;</th>
  29. </tr>
  30. <tr>
  31.   <td>Fila 1</td>
  32.   <td><button onclick="borrarFila(this)" class="borrar">Borrar</button></td>
  33. </tr>
  34. <tr>
  35.   <td>Fila 2</td>
  36.   <td><button onclick="borrarFila(this)" class="borrar">Borrar</button></td>
  37. </tr>
  38. <tr>
  39.   <td>Fila 3</td>
  40.   <td><button onclick="borrarFila(this)" class="borrar">Borrar</button></td>
  41. </tr>
  42. </body>
  43. </html>

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.