Foros del Web » Programando para Internet » Javascript »

Problema de compatibilidad DOM

Estas en el tema de Problema de compatibilidad DOM en el foro de Javascript en Foros del Web. Resulta que tengo el siguiente codigo y funcionaba bien en firefox y en IE, pero ahora solo me corre en firefox ... si alguien sabe ...
  #1 (permalink)  
Antiguo 24/11/2008, 12:37
 
Fecha de Ingreso: diciembre-2007
Mensajes: 4
Antigüedad: 16 años, 4 meses
Puntos: 0
Problema de compatibilidad DOM

Resulta que tengo el siguiente codigo y funcionaba bien en firefox y en IE, pero ahora solo me corre en firefox ... si alguien sabe que etiquetas debo cambiar para que me corran en ambos se los agradeceria mucho.

saludos.

codigo:

<script type="text/javascript" language="javascript">
var count = 0;
function addLine(){
count += 1;

var content = document.getElementById('ul');
var LI = document.createElement('li');
var TABLA = document.createElement('table');
var FILA1 = document.createElement('tr');
var FILA2 = document.createElement('tr');
var FILA3 = document.createElement('tr');

TABLA.setAttribute('cellpadding', 2);
TABLA.setAttribute('cellspacing', 0);
TABLA.setAttribute('width', "100%");
TABLA.setAttribute('border', "0");

var COLUMNA1 = document.createElement('td');
COLUMNA1.setAttribute('width', 250);
COLUMNA1.align = 'right';

var COLUMNA2 = document.createElement('td');
COLUMNA2.align = 'left';
COLUMNA2.setAttribute('class',"formContacto");

var COLUMNA3 = document.createElement('td');
COLUMNA3.setAttribute('width', 250);
COLUMNA3.align = 'right';

var COLUMNA4 = document.createElement('td');
COLUMNA4.align = 'left';
COLUMNA4.setAttribute('class',"formContacto");

var COLUMNA5 = document.createElement('td');
COLUMNA5.setAttribute('width', 250);
COLUMNA5.align = 'right';

var COLUMNA6 = document.createElement('td');
COLUMNA6.align = 'left';
COLUMNA6.setAttribute('class',"formContacto");

var input0 = document.createElement('input');
input0.setAttribute('runnat', "server");
input0.setAttribute('class','formContacto');
input0.type = 'text';
input0.name = 'myInput' + count + '_0';

var input1 = document.createElement('input');
input1.type = 'text';
input1.name = 'myInput' + count + '_1';
input1.setAttribute('class','formContacto');

var input2 = document.createElement('input');
input2.type = 'text';
input2.name = 'myInput' + count + '_2';
input2.setAttribute('class','formContacto');

var text1 = document.createTextNode("Product: ");
var text2 = document.createTextNode("Own Product / Thrid party-Vendor name: ");
var text3 = document.createTextNode("Revenue US$(last three fisical years): ");

LI.appendChild(TABLA);
TABLA.appendChild(FILA1);
TABLA.appendChild(FILA2);
TABLA.appendChild(FILA3);

FILA1.appendChild(COLUMNA1);
COLUMNA1.appendChild(text1);
FILA1.appendChild(COLUMNA2);
COLUMNA2.appendChild(input0);

FILA2.appendChild(COLUMNA3);
COLUMNA3.appendChild(text2);
FILA2.appendChild(COLUMNA4);
COLUMNA4.appendChild(input1);

FILA3.appendChild(COLUMNA5);
COLUMNA5.appendChild(text3);
FILA3.appendChild(COLUMNA6);
COLUMNA6.appendChild(input2);

content.appendChild(LI);
}
</script>
  #2 (permalink)  
Antiguo 24/11/2008, 12:43
Avatar de Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: Problema de compatibilidad DOM

Para que funcione en explorer tenés que crear un elemento tbody, en ese elemento insertar filas y columnas y luego agregar ese tbody al elemento table.
  #3 (permalink)  
Antiguo 24/11/2008, 14:00
 
Fecha de Ingreso: diciembre-2007
Mensajes: 4
Antigüedad: 16 años, 4 meses
Puntos: 0
Respuesta: Problema de compatibilidad DOM

Cita:
Iniciado por Panino5001 Ver Mensaje
Para que funcione en explorer tenés que crear un elemento tbody, en ese elemento insertar filas y columnas y luego agregar ese tbody al elemento table.

var TBODY = document.createElement('tbody');
LI.appendChild(TABLA);
TABLA.appendChild(TBODY);
TBODY.appendChild(FILA1);
TBODY.appendChild(FILA2);
TBODY.appendChild(FILA3);

estas lineas las agregue segun tu explicacion pero no funciono... estan bien asi??
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:00.