Foros del Web » Programando para Internet » Javascript »

Problema getElementByID en IE

Estas en el tema de Problema getElementByID en IE en el foro de Javascript en Foros del Web. Tengo problemas en el IE con una funcion en javascript :: por la parte HTMl tengo esto Código HTML: <p> <a href=\"javascript :nuevoUsuario();\" id=\"linkNewUser\"> <img ...
  #1 (permalink)  
Antiguo 08/03/2006, 05:40
 
Fecha de Ingreso: diciembre-2004
Mensajes: 278
Antigüedad: 19 años, 4 meses
Puntos: 0
Problema getElementByID en IE

Tengo problemas en el IE con una funcion en javascript::
por la parte HTMl tengo esto
Código HTML:
<p><a href=\"javascript:nuevoUsuario();\" id=\"linkNewUser\">
			<img src=\"".$this->urlImg."/plus.gif\" id=\"imgLinkNewUser\"/> Nuevo usuario</a>
		</p>
<table><tbody id=\"tablaTemp\"></tbody></table> 
y por la de javascript esto otro:

Código HTML:
function nuevoUsuario()
{	document.getElementById('imgLinkNewUser').src='".$this->urlImg."/minus.gif';
				document.getElementById('linkNewUser').lastChild.nodeValue='Cancelar';
				document.getElementById('linkNewUser').href='javascript:cancelarUsuario();';
				tabla=document.getElementById('tablaTemp');
				TR1=document.createElement('tr');
					tdNom=document.createElement('td');
					//tdNom.width='3';
						inputNom=document.createElement('input');
						inputNom.type='text';
						inputNom.name='nombre';
						inputNom.id='nombre';	
						inputNom.style.width='115';
					tdApellido=document.createElement('td');
						inputApellido=document.createElement('input');
						inputApellido.type='text';
						inputApellido.name='apellidos';
						inputApellido.id='apellidos';
						inputApellido.style.width='128';
					tdDepartamento=document.createElement('td');
						[HTML]
inputDepartamento=document.createElement('select') ;
inputDepartamento.name='departamento';
inputDepartamento.id='departamento';
inputDepartamento.style.width='190';

tdEmail=document.createElement('td');
inputEmail=document.createElement('input');
inputEmail.type='text';
inputEmail.name='email';
inputEmail.id='email';
tdOk=document.createElement('td');
linkOk=document.createElement('a');
linkOk.href='javascript:document.formulari.pet_est at.value=\"addUser\";document.formulari.submit();' ;
imageOk=document.createElement('img');
imageOk.src='".$this->urlImg."/mini-ok.gif';


//---AJUNTAMOS LAS COSAS
linkOk.appendChild(imageOk);
tdOk.appendChild(linkOk);
tdEmail.appendChild(inputEmail);
tdDepartamento.appendChild(inputDepartamento);
tdNom.appendChild(inputNom);
tdApellido.appendChild(inputApellido);
TR1.appendChild(tdNom);
TR1.appendChild(tdApellido);
TR1.appendChild(tdDepartamento);
TR1.appendChild(tdEmail);
TR1.appendChild(tdOk);
tabla.appendChild(TR1);

//---OBTENEMOS LA LISTA DE DEPARTAMENTOS
http.open('GET', url, true);
http.onreadystatechange = respuestaDepartamentoHttp;
http.send(null);
}
[/HTML]

Lo que hace esta funcion es crear una serie de celdas con inputs dentro en la tabla que os he enseñado.
En mozilla me funciona perfectamente, su consola de javascript no me devuelve ningun error pero en IE 6 ademas de saltarme un error no funciona.
El error que me indica es en esta linea:
tabla=document.getElementById('tablaTemp');
DIce que el metodo no existe...

EDIT III:SOlucionado.> Yo esque lo flipo con el explorer,el error me lo daba ayer... hoy lo pruebo y funciona.
Que yo sepa no he canviado nada, pero vamos... algo habré tocado.

Última edición por clinisbut; 09/03/2006 a las 02:06 Razón: solucionado
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 05:42.