Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/09/2007, 19:55
crnieto05
 
Fecha de Ingreso: abril-2007
Ubicación: España
Mensajes: 19
Antigüedad: 17 años, 1 mes
Puntos: 1
Pregunta appendChild TR en Internet Explorer IE

Tengo el siguiente codigo que funciona bien para FireFox pero no en IE, la versión de IE es 7.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>
<script language="JavaScript" type="text/javascript">
<!--
var linea = 1;
function agregar() {
alert(linea);
var tr = document.createElement('tr');

var td1 = document.createElement('td');
var td2 = document.createElement('td');
var td3 = document.createElement('td');
var td4 = document.createElement('td');

var input1 = document.createElement('input');
input1.setAttribute('value','1');
input1.setAttribute('name','ser_'+linea);
var input2 = document.createElement('input');
input2.setAttribute('value','2');
input2.setAttribute('name','tit_'+linea);

var input3 = document.createElement('input');
input3.setAttribute('value','3');
input3.setAttribute('name','int_'+linea);

var input4 = document.createElement('input');
input4.setAttribute('value','4');
input4.setAttribute('name','apo_'+linea);

var inputh = document.createElement('input');
inputh.setAttribute('type','hidden');
inputh.setAttribute('name','id_'+linea);
inputh.setAttribute('value','5');

td1.appendChild(input1);
td2.appendChild(input2);
td3.appendChild(input3);
td4.appendChild(input4);
document.Prueba.appendChild(inputh);
tr.appendChild(td1);
tr.appendChild(td2);
tr.appendChild(td3);
tr.appendChild(td4);
document.getElementById('seccion1').appendChild(tr );
alert(tr.tagName);
linea++;
}
//-->
</script>

<body>
<form action="" method="post" name="Prueba">
<table id="seccion1" width="500" bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="vertab" width="48" align="center"></td>
<td class="vertab" width="264" align="center">Designaci&oacute;n</td>
<td class="vertab" width="121" align="center">P/N</td>
<td class="vertab" width="66" align="center">Cant.</td>
</tr>
</table>
<a href="javascript:agregar();">a</a>
</form>
</body>
</html>

Supuestamente el codigo debe funcionar en IE, pero no es así.
Agradezco por la ayuda que puedan brindarme.

Saludos,
Cristian