Foros del Web » Programando para Internet » Javascript »

Arbol en JavaScript

Estas en el tema de Arbol en JavaScript en el foro de Javascript en Foros del Web. Hola, quiero hacer una funcion que a partir de un tema, despliegue a sus "hijos" debajo de él, algo como en el explorador de windows ...
  #1 (permalink)  
Antiguo 06/06/2002, 10:20
 
Fecha de Ingreso: junio-2002
Mensajes: 11
Antigüedad: 21 años, 10 meses
Puntos: 0
Arbol en JavaScript

Hola, quiero hacer una funcion que a partir de un tema, despliegue a sus "hijos" debajo de él, algo como en el explorador de windows ¿como le puede hacer?

;) De antemano gracias.
  #2 (permalink)  
Antiguo 06/06/2002, 11:34
 
Fecha de Ingreso: febrero-2002
Ubicación: Santiago
Mensajes: 253
Antigüedad: 22 años, 2 meses
Puntos: 0
Re: Arbol en JavaScript

lo puedes bajar de DynamicDrive.com en la sección Menús and Navigation System, el ejemplo se llama: Smart Folding Menu Tree Script
;)
  #3 (permalink)  
Antiguo 06/06/2002, 15:18
Avatar de DragonX
Colaborador
 
Fecha de Ingreso: mayo-2002
Ubicación: Funkyland
Mensajes: 8.433
Antigüedad: 22 años
Puntos: 177
Re: Arbol en JavaScript

para vos bombon! ;)
<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(op en.gif)"
}
else {
nested.style.display="none"
event.srcElement.style.listStyleImage="url(fo ld.gif)"
}
}
}

document.onclick=change

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

<body bgcolor="#FFFFFF">
<ul>
<li id="foldheader">News</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.cnn.com">CNN</a></li>
<li><a href="http://www.abcnews.com">ABC News</a></li>
<li><a href="http://www.vancouversun.com">Vancouver Sun</a></li>
</ul>

<li id="foldheader">Games</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.gamespot.com">GameSpot</a></li>
<li><a href="http://www.happypuppy.com">Happy Puppy</a></li>
<li><a href="http://www.gamecenter.com">Game Center</a></li>
</ul>

<li id="foldheader">Software</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.download.com">outer 1</a></li>
<li><a href="http://www.hotfiles.com">outer 2</a></li>
<li id="foldheader">Nested</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.w
  #4 (permalink)  
Antiguo 06/06/2002, 19:25
 
Fecha de Ingreso: enero-2002
Mensajes: 13
Antigüedad: 22 años, 3 meses
Puntos: 0
Re: Arbol en JavaScript

---------------------------------------------------------------------------------
  #5 (permalink)  
Antiguo 10/06/2002, 13:19
 
Fecha de Ingreso: junio-2002
Mensajes: 11
Antigüedad: 21 años, 10 meses
Puntos: 0
Re: Arbol en JavaScript

Muchas gracias a todos por su ayuda, me sirvio de mucho.
;)
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 01:23.