Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/02/2011, 05:15
rotivo
 
Fecha de Ingreso: junio-2010
Mensajes: 124
Antigüedad: 13 años, 11 meses
Puntos: 3
funcion javascript a traves de ajax

Buenas a todos, pues mi problema surge en que asigno evento onclick a enlaces href mediante javascript en el body onload. Hasta ahí bien. El problema surge cuando pulso un enlace href para cambiar contenido de un div mediante ajax ya que tieen que tambien ejecutarse la misma funcion javascript para cambiar eventos onclick pero ahí ya no funciona. Les pego el javascript. A ver si alguien me da una pista, gracias:

Código:
function menuGallego() {
	var contenedor=document.getElementById('menudinamico').getElementsByTagName('a');
	var menuG=document.getElementById('menuidioma').getElementsByTagName('a');
	var gecko = navigator.userAgent.toLowerCase();
		if (gecko.indexOf('gecko')!=-1) { // es cualquier navegador Gecko
			contenedor[0].setAttribute("onclick","FAjax ('empresa_gallego.html','texto',null,'GET'); return false");
			contenedor[1].setAttribute("onclick","FAjax ('ofertas_gallego.html','texto',null,'GET'); return false");
			contenedor[2].setAttribute("onclick","FAjax ('cursos_gallego.html','texto',null,'GET'); return false");
			contenedor[3].setAttribute("onclick","FAjax ('localizacion_gallego.html','texto',null,'GET'); return false");
			contenedor[4].setAttribute("onclick","FAjax ('soporte_gallego.html','texto',null,'GET'); return false");
			menuC[1].setAttribute("onclick","tamanoFuente(); FAjax ('empresa.html','texto',null,'GET'); menuCastellano(); return false");
		}
		
		else { //es Internet Explorer 
			contenedor[0]['onclick']=new Function('FAjax ("empresa_gallego.html","texto",null,"GET"); return false');
			contenedor[1]['onclick']=new Function('FAjax ("ofertas_gallego.html","texto",null,"GET"); return false');
			contenedor[2]['onclick']=new Function('FAjax ("cursos_gallego.html","texto",null,"GET"); return false');
			contenedor[3]['onclick']=new Function('FAjax ("localizacion_gallego.html","texto",null,"GET"); return false');
			contenedor[4]['onclick']=new Function('FAjax ("soporte_gallego.html","texto",null,"GET"); return false');	
			menuC[0]["onclick"]=new Function("tamanoFuente(); FAjax ('empresa.html','texto',null,'GET'); menuCastellano(); return false");
		}
}
Edito: En Chrome y Safari no me asgina los eventos onclick ni la primera vez.