Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/01/2010, 12:04
wildnetboy
 
Fecha de Ingreso: julio-2009
Mensajes: 5
Antigüedad: 15 años, 8 meses
Puntos: 0
Exclamación Problema de tablas con javascript

Hola amigos, pues aca recurriendo a ustedes a ver si me pueden ayudar a resolver mi problema, es un caso raro pero a ver si alguien de ustedes ya le ocurio y supo resolverlo...


El problema es el siguiente:
Tengo una pagina HTML con codigo javascript, cuando acceso a ella en el servidor ( se llama HP1) por medio de localhost la pagina me aparece normal y todo funciona de maravilla, el problema es cuando acceso a la pagina desde cualquier otra maquina de la red y es que cuando pongo el nombre del servidor me descuadra la tabla que cree con javascript es decir si pongo http://192.168.0.1/convenio/convenios.html la pagina me parece normal y todo se ve bien, pero al poner http://hp1/convenio/convenios.html la tabla se descuadra y no se ve bien

Se me descuadra en la celda7 que es a la que le doy atributo de rowspan=2 entonces la fila 2 ya me la deja todo descuadrado.

les dejo el codigo de la tabla a ver si alguien encuentra algun error.
Código Javascript:
Ver original
  1. cont=1;
  2. function OtroDetalle()
  3. {
  4.       cont++;
  5.       var tabla = document.getElementById("detalles").tBodies[0];
  6.       var fila = document.createElement("TR");
  7.       fila.setAttribute("align","center");
  8.       var celda1 = document.createElement("TD");
  9.       var nivel = document.createElement("INPUT");
  10.       nivel.setAttribute("type","text");
  11.       nivel.setAttribute("size","15");
  12.       nivel.setAttribute("maxlength","23");
  13.       nivel.setAttribute("id","nivel" + cont);
  14.       celda1.appendChild(nivel);
  15.       var celda2 = document.createElement("TD");
  16.       var turno = document.createElement("INPUT");
  17.       turno.setAttribute("type","text");
  18.       turno.setAttribute("size","8");
  19.       turno.setAttribute("maxlength","20");
  20.       turno.setAttribute("id","turno" + cont);
  21.       celda2.appendChild(turno);
  22.       var celda3 = document.createElement("TD");
  23.       var sistema = document.createElement("INPUT");
  24.       sistema.setAttribute("type","text");
  25.       sistema.setAttribute("size","15");
  26.       sistema.setAttribute("maxlength","20");
  27.       sistema.setAttribute("id","sistema" + cont);
  28.       celda3.appendChild(sistema);
  29.       var celda4 = document.createElement("TD");
  30.       var modalidad = document.createElement("INPUT");
  31.       modalidad.setAttribute("type","text");
  32.       modalidad.setAttribute("size","7");
  33.       modalidad.setAttribute("maxlength","20");
  34.       modalidad.setAttribute("id","modalidad" + cont);
  35.       celda4.appendChild(modalidad);
  36.       var celda5 = document.createElement("TD");
  37.       var ciclo = document.createElement("INPUT");
  38.       ciclo.setAttribute("type","text");
  39.       ciclo.setAttribute("size","10");
  40.       ciclo.setAttribute("maxlength","20");
  41.       ciclo.setAttribute("id","ciclo" + cont);
  42.       celda5.appendChild(ciclo);
  43.       var celda6 = document.createElement("TD");
  44.       var des_colegiatura = document.createElement("INPUT");
  45.       des_colegiatura.setAttribute("type","text");
  46.       des_colegiatura.setAttribute("size","3");
  47.       des_colegiatura.setAttribute("maxlength","4");
  48.       des_colegiatura.setAttribute("id","des_colegiatura" + cont);
  49.       celda6.appendChild(des_colegiatura);
  50.       var des_inscripcion = document.createElement("INPUT");
  51.       des_inscripcion.setAttribute("type","text");
  52.       des_inscripcion.setAttribute("size","3");
  53.       des_inscripcion.setAttribute("maxlength","4");
  54.       des_inscripcion.setAttribute("id","des_inscripcion" + cont);
  55.       celda6.appendChild(des_inscripcion);
  56.       var celda7 = document.createElement('TD');
  57.       var imagen = document.createElement('IMG');
  58.       celda7.setAttribute("rowspan","2");
  59.       celda7.setAttribute("bgcolor","#0066FF");
  60.       imagen.setAttribute('src','images/delete.png');
  61.       imagen.setAttribute('width','16');
  62.       imagen.setAttribute('height','16');
  63.       imagen.setAttribute('alt','Eliminar');
  64.       imagen.setAttribute("id", "imagen"+cont);
  65.       imagen.setAttribute("name", "imagen"+cont);
  66.       imagen.onClick=function()
  67.       {      
  68.             borrarFila(this,1);
  69.       };  
  70.       celda7.appendChild(imagen);
  71.       var fila2 = document.createElement("TR");
  72.       fila2.setAttribute("align","center");
  73.       fila2.setAttribute("id","fila"+cont);
  74.       var celdaN = document.createElement("TD");
  75.       var obs = document.createElement("TEXTAREA");
  76.       obs.setAttribute("cols","45");
  77.       obs.setAttribute("rows","2");
  78.       obs.setAttribute("id","obs" + cont);
  79.       var texto = document.createTextNode("Observaciones:");
  80.       celdaN.setAttribute("colspan","3");
  81.       celdaN.appendChild(texto);
  82.       celdaN.appendChild(obs);
  83.      
  84.       fila.appendChild(celda1);
  85.       fila.appendChild(celda2);
  86.       fila.appendChild(celda3);
  87.       fila.appendChild(celda4);
  88.       fila.appendChild(celda5);
  89.       fila.appendChild(celda6);
  90.       fila.appendChild(celda7);
  91.       fila2.appendChild(celdaN);
  92.       tabla.appendChild(fila);
  93.       tabla.appendChild(fila2);      
  94. }
Código HTML:
Ver original
  1. <body  class="nihilo" onload="OtroDetalle();">
  2. <table align=center width=20% cellpadding=0 cellspacing=0 id="detalles" border="1">
  3.             <tr>
  4.                 <td colspan="7" class="encabezado">
  5.                     Detalles del convenio
  6.                 </td>
  7.             </tr>
  8.             <tr align="center">
  9.                 <td>Nivel</td>
  10.                 <td>Turno</td>
  11.                 <td>Sistema</td>
  12.                 <td>Modalidad</td>
  13.                 <td>Ciclo</td>
  14.                 <td>Desc Colegiatura e Inscripcion</td>
  15.                 <td>&nbsp;</td>
  16.             </tr>
  17.         </table>
  18. </body>

En el evento onLoad del body mando a llamar la funcion para que me agregue las 2 filas iniciales que necesito pero ocurre lo que les comente al principio.
El chiste es agregar dinamicamente las filas y borrarlas, todo eso funciona muy bien pero el problema es que se me descuadra