Ver Mensaje Individual
  #6 (permalink)  
Antiguo 21/12/2009, 10:01
naxete85
 
Fecha de Ingreso: enero-2009
Mensajes: 12
Antigüedad: 15 años, 3 meses
Puntos: 0
Respuesta: Controlar atributo rowSpan de una tabla a través de javascript

Cita:
Iniciado por quimfv Ver Mensaje
Javascript distingue mayúsculas de minúsculas...

rowSpan no rowspan


Código HTML:
Ver original
  1. <script language="JavaScript">
  2. function function1() {
  3.     document.getElementById("myTableHeader").rowSpan += 1;
  4. }
  5. function function2() {
  6.     location.reload();
  7. }
  8. <table width="542" border="10" bordercolor="red" cellpadding="20">
  9.     <tr>
  10.         <th id="myTableHeader">Cell 1</th>
  11.         <th>Cell 2</th>
  12.         <th id="th5">Cell 3</th>
  13.     </tr>
  14.     <tr>
  15.         <th>Cell 4</th>
  16.         <th id="th2">Cell 5</th>
  17.         <th>Cell 6</th>
  18.     </tr>
  19.     <tr>
  20.         <th>Cell 7</th>
  21.         <th>Cell 8</th>
  22.         <th>Cell 9</th>
  23.     </tr>
  24.     <tr>
  25.         <th >Cell 10</th>
  26.         <th >Cell 11</th>
  27.         <th >Cell 12</th>
  28.     </tr>
  29. <input type="button" value="Span(2) Cell 1" onClick="function1();">
  30. <input type="button" value="Restore" onClick="function2();">
  31. </body>
  32. </html>

Esto hace lo que pides pero, no del todo!!! (he modificado un poco el ejemplo que dan [URL="http://www.java2s.com/Code/JavaScriptReference/Javascript-Properties/rowSpan.htm"]aqui[/URL])

Código HTML:
Ver original
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <title>Documento sin t&iacute;tulo</title>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. <script language="JavaScript" type="text/JavaScript">
  5. function frowspan(direccion){
  6. if(direccion=="0"){
  7. document.getElementById("celdalarga").rowSpan+=1;
  8. }else{
  9. document.getElementById("celdalarga").rowSpan-=1;
  10. }
  11. }
  12.  
  13.  
  14. </head>
  15.  
  16. <table width="100%" border="1" cellspacing="0" cellpadding="0">
  17.   <tr>
  18.     <td rowspan="5" id="celdalarga">&nbsp;</td>
  19.     <td>&nbsp;</td>
  20.     <td><input type="button" name="BotEli" value="Eliminar esta"></td>
  21.   </tr>
  22.   <tr>
  23.     <td>&nbsp;</td>
  24.   </tr>
  25.   <tr>
  26.     <td>&nbsp;</td>
  27.     <td>&nbsp;</td>
  28.   </tr>
  29.   <tr>
  30.     <td>&nbsp;</td>
  31.     <td><input type="button" name="Submit2" value="Eliminar esta"></td>
  32.   </tr>
  33.   <tr>
  34.     <td><input type="button" name="Submit3" value="Agregar una"  onclick="frowspan('0')"></td>
  35.     <td><input type="button" name="veurerowspan" value="Quitar una" onclick="frowspan('1')"></td>
  36.   </tr>
  37.  
  38. </body>
  39. </html>

Este es mio


Yo me plantearia muy seriamente la opcion que te ha dado CHuLoSoY.

Quim

Es justo lo que necesitaba,

gracias a todos