Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/05/2011, 22:35
RenacidoJH
 
Fecha de Ingreso: marzo-2011
Mensajes: 5
Antigüedad: 13 años, 2 meses
Puntos: 0
Pregunta Problema al Agregar TR a un TBODY

Cordial Saludo,

les escribo a ustedes ya que no he podido solucionar un pequeño inconveniente que tengo con la siguiente funcion JavaScript que no funciona en IE*, pero el Mozilla y Chrome SI:

* Probado en IE9 (Me imagino que en las otras tampoco).
Código Javascript:
Ver original
  1. function addHora() {
  2.  var hora = parseInt(document.horario.tothoras.value);
  3.  hora = (hora + 1);
  4.  var newTR = "<tr>\n";
  5.  if (hora > 3 && (hora - 1) % 3 == 0) {        
  6.   newTR += "<th class='title2' colspan='7'>Descanso</th>\n";
  7.   newTR += "</tr>\n"
  8.   newTR += "<tr>\n";
  9.  }
  10.  newTR += "<th class='title2'>" + hora + "ª Hora</th>\n";
  11.  for (var i = 1; i <= 6; i++) {
  12.   newTR += '<td id="' + dia(i) + "-" + hora + '">\n';
  13.   newTR += tdVacio(dia(i), hora);
  14.   newTR += "</td>\n";
  15.  }
  16.  newTR += "</tr>\n";
  17.  alert('Checkpoint 1');
  18.  alert(newTR);
  19.  document.getElementById("clases").innerHTML = newTR;
  20.  alert('Checkpoint 2');
  21.  document.horario.tothoras.value = hora;
  22. }
El cual se supone agrega un TR con varios TD en la siguiente tabla:
Código HTML:
Ver original
  1. <tr>
  2. <th class="title2" scope="col">Hora</th>
  3. <th class="title2" scope="col">Lunes</th>
  4. <th class="title2" scope="col">Martes</th>
  5. <th class="title2" scope="col">Miercoles</th>
  6. <th class="title2" scope="col">Jueves</th>
  7. <th class="title2" scope="col">Viernes</th>
  8. <th class="title2" scope="col">Sabado</th>
  9. </tr>
  10. <tbody id="clases">
Alguien sabe, cual puede ser el inconveniente??? agradecería cualquier tipo de ayuda.

Les comento que me muestra los mensajes: Checkpoint 1 y el contenido de la variable newTR. pero no sale el mensaje Checkpoint 2.