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

Hola, tnego un problema para que me asigne el evento onclick mediante una funcion en los navegadores Firefox/Chrome: aqui les pego:

function menuGallego() {
var contenedor=document.getElementById('menudinamico') .getElementsByTagName('a');
var menuG=document.getElementById('menuidioma').getEle mentsByTagName('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");
menuG[0].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');
menuG[0]["onclick"]=new Function("tamanoFuente(); FAjax ('empresa.html','texto',null,'GET'); menuCastellano(); return false");
}
}

En teoría debería funcionar ya que son navegadores gecko. Un saludo agradezco una ayudita.