Foros del Web » Programando para Internet » Javascript »

menus tipo arbol con javascript

Estas en el tema de menus tipo arbol con javascript en el foro de Javascript en Foros del Web. Tengo el siguiente problema: Tengo un menu tipo arbol en javascript y al parecer en el explorer se me desplega perfectamente pero en el mozilla ...
  #1 (permalink)  
Antiguo 15/04/2004, 11:16
 
Fecha de Ingreso: marzo-2004
Mensajes: 550
Antigüedad: 20 años, 1 mes
Puntos: 7
Sonrisa menus tipo arbol con javascript

Tengo el siguiente problema:

Tengo un menu tipo arbol en javascript y al parecer en el explorer se me desplega perfectamente pero en el mozilla no se me desplega.

¿puede ser que no es compatible para el mozilla este menu tipo arbol?

Si ése es el error, ¿sabeis donde puedo bajarme algun script que implemente un menu tipo arbol que no sea de esos tipicos que te crean mogollon de paginas y archivos al generar el arbol ya que el que estoy utilizando yo es un pequeño codigo javascript que incluyo dentro de mi pagina?


Gracias a todos por la labor que haceis al leer e intentar resolver dudas.
  #2 (permalink)  
Antiguo 15/04/2004, 11:29
Avatar de KarlanKas
Moderador extraterrestre
 
Fecha de Ingreso: diciembre-2001
Ubicación: Madrid
Mensajes: 6.987
Antigüedad: 22 años, 4 meses
Puntos: 61
Hola aeb_asturias (Patria querida)!

Para poderte ayudar sobre un script lo mejor es que nos lo pongas... así se te podrá ayudar con más conocimiento de causa. A lo mejor a tu menú sólo le falta una chorradilla...

__________________
Cómo escribir

No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia.
  #3 (permalink)  
Antiguo 15/04/2004, 13:10
 
Fecha de Ingreso: marzo-2004
Mensajes: 550
Antigüedad: 20 años, 1 mes
Puntos: 7
Gracias KarlanKas por responder. Aqui te paso el script para que le puedas echar un vistazo a ver si es alguna tonteria que por mis bajos conocimientos de javascript desconozco:


<!--
Nota: Las imágenes de este script se encuentran en la carpeta Exportar.
-->

<html>
<head>
<title> Carpetas IE </title>
<style>
<!--
#foldheader{cursor:hand ; font-weight:bold ;
list-style-image:url(fold.gif)}
#foldinglist{list-style-image:url(list.gif)}
//-->
</style>
<script language="JavaScript1.2">
<!--
/**
* Based on Folding Menu Tree
* Dynamic Drive (www.dynamicdrive.com)
*/

var head="display:''";
img1=new Image();
img1.src="fold.gif";
img2=new Image();
img2.src="open.gif";

function change(){
if(!document.all)
return
if (event.srcElement.id=="foldheader") {
var srcIndex = event.srcElement.sourceIndex
var nested = document.all[srcIndex+1]
if (nested.style.display=="none") {
nested.style.display=''
event.srcElement.style.listStyleImage="url(pc.gif) "
}
else {
nested.style.display="none"
event.srcElement.style.listStyleImage="url(pc.gif) "
}
}
}

document.onclick=change

//-->
</script>
</head>

<body bgcolor="#FFFFFF">
<ul>

<li id="foldheader">Laboratorio</li>
<ul id="foldinglist" style="display:none" style=&{head};
<li><a href="http://www.cnn.com">PCINF159</a></li>
<li><a href="http://www.abcnews.com">PCINF160</a></li>
<li><a href="http://www.vancouversun.com">PCINF162</a></li>
</ul>

<li id="foldheader">Informatica</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.gamespot.com">PCINF101</a></li>
<li><a href="http://www.happypuppy.com">PCINF102</a></li>
<li><a href="http://www.gamecenter.com">PCINF103</a></li>
</ul>

<li id="foldheader">Telematica</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.download.com">PCINF201</a></li>
<li><a href="http://www.hotfiles.com">PCINF202</a></li>
<li id="foldheader">PCINF203</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.windows95.com">tarjeta red 1</a></li>
<li><a href="http://www.shareware.com">tarjeta red 2</a></li>
</ul>
<li><a href="http://www.epsig.inforg.uniovi.es">Industriales</a></li>
<li><a href="http://www.shareware.com">Telecomunicaciones</a></li>
</ul>
</ul>
<script language="JavaScript1.2">
<!--
/**
* Get cookie routine by Shelley Powers
* ([email protected])
*/
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
// if cookie exists
if (offset != -1) {
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(off set, end))
}
}
return returnvalue;
}

if (get_cookie(window.location.pathname) != ''){
var openresults=get_cookie(window.location.pathname).s plit(" ")
for (i=0 ; i < openresults.length ; i++){
foldinglist[openresults[i].style.display=''
document.all[foldinglist[openresults[i].sourceIndex -
1].style.listStyleImage="url(open.gif)"
}
}

if (document.all){
var nodelength=foldinglist.length-1
var nodes=new Array(nodelength)
var openones=''
}

function check(){
for (i=0 ; i <= nodelength ; i++){
if (foldinglist[i].style.display=='')
openones=openones + " " + i
}
document.cookie=window.location.pathname+"="+openo nes
}

if (document.all)
document.body.onunload=check
//-->
</script>

</body>
</html>
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 21:26.