Avatar billede intel4ever Nybegynder
15. april 2004 - 09:10 Der er 4 kommentarer og
1 løsning

Fil træ

hej jeg er ved at lave et filtræ lignene side men det virker ikke rigtigt som det skal efter et par pyre har rodet i koden er der ikke en der kan hjælpe med at fixe den jeg tror det er noget med plaseringen af <li><ul> 
her er hele kode ()den virker ikke uden billederne jeg kan godt sende dem hvis nødvændigt

på forhånd tak.
M.V.H. René Kvist



<html>

<head>
<meta http-equiv="Content-Language" content="da">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>File tree</title>
<base target="_self">




<meta name="generator" content="ZZEE HTML Listing" />

<style type="text/css">

    body
    {   
        font-family: "Times New Roman";
        font-size: 12pt;
        background-color: #ffffff;
        color: #000000;
        text-align: left;
    }
    ul.zzul {list-style-type:none; display: block;}
    span.zzspace {position:relative; left:11px;}
    a, a:visited {color: #0000ff;}
    a:hover { color: #ff0000;}
    td
    {   
        font-family: "Times New Roman";
        font-size: 12pt;
        color: #000000;
        text-align: left;
    }
    table {border: none; width:100%; padding:3px;}

</style>








<script type="text/javascript">
function exp_coll(ind)
{
s = document.getElementById("sp_" + ind);
i = document.getElementById("im_" + ind);
i2 = document.getElementById("im2_" + ind);

if (s.style.display == 'none')
{
  s.style.display = 'block';
  i.src = "images/public/minus.gif";
  i2.src = "images/public/folder.open.gif";
}
else if (s.style.display == 'block')
{
  s.style.display = 'none';
  i.src = "images/public/plus.gif";
  i2.src = "images/public/folder.gif";
}
}




function coll_all()
{
  ind = 1;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }

  ind = 2;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }

  ind = 3;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }

  ind = 4;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }

  ind = 5;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }

  ind = 200;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }

  ind = 201;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }
}




function exp_all()
{

  ind = 1;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'block';
  if (x.style.display == 'block')
  {
    document.getElementById("im_" + ind).src = "images/public/minus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.open.gif";
  }

  ind = 2;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'block';
  if (x.style.display == 'block')
  {
    document.getElementById("im_" + ind).src = "images/public/minus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.open.gif";
  }

  ind = 3;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'block';
  if (x.style.display == 'block')
  {
    document.getElementById("im_" + ind).src = "images/public/minus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.open.gif";
  }

  ind = 4;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'block';
  if (x.style.display == 'block')
  {
    document.getElementById("im_" + ind).src = "images/public/minus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.open.gif";
  }

  ind = 5;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'block';
  if (x.style.display == 'block')
  {
    document.getElementById("im_" + ind).src = "images/public/minus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.open.gif";
  }

  ind = 200;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'block';
  if (x.style.display == 'block')
  {
    document.getElementById("im_" + ind).src = "images/public/minus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.open.gif";
  }
  ind = 201;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'block';
  if (x.style.display == 'block')
  {
    document.getElementById("im_" + ind).src = "images/public/minus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.open.gif";
  }
</script>
</head>

<body>
<p><a href="experimental.asp" target = main>Forside</a></p>
<a href="java script:exp_all();"><img src="images/public/plus.gif" border='0' alt="toggle" width="11" height="11" /> udvid alle</a><br>
<a href="java script:coll_all();"><img src="images/public/minus.gif" border='0' alt="toggle" width="11" height="11" /> sammel alle</a>



<ul class="zzul">
<li>
<p><a href="java script:exp_coll(1);">
<img src="images/public/minus.gif" border='0' id="im_1" alt="toggle" width="11" height="11" /></a>
<a href="java script:exp_coll(1);">
<img src="images/public/folder.open.gif" border='0' id="im2_1" alt="icon"/></a>
                1.
                </p>
<ul class="zzul" id="sp_1" style="display:block;">
<script type="text/javascript">
  ind = 1;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }
</script>
           
<li><span class="zzspace">&nbsp;<img src="images/public/layout.gif" alt="icon" width="20" height="22"/>&#160;<a href="document.asp"target = main>1.1</a></span></li>
<li><span class="zzspace">&nbsp;<img src="images/public/layout.gif" alt="icon" width="20" height="22"/>&#160;<a href="document.asp"target = main>1.2</a></span></li>
<li><span class="zzspace">&nbsp;<img src="images/public/layout.gif" alt="icon" width="20" height="22"/>&#160;<a href="document.asp"target = main>1.3</a></span></li>
<li><span class="zzspace">&nbsp;<img src="images/public/layout.gif" alt="icon" width="20" height="22"/>&#160;<a href="document.asp"target = main>1.4</a></span></li>
<li><span class="zzspace">&nbsp;<img src="images/public/layout.gif" alt="icon" width="20" height="22"/>&#160;<a href="document.asp"target = main>1.5</a></span></li>

</ul>
</li>
<li>


<p><a href="java script:exp_coll(2);">
<img src="images/public/minus.gif" border='0' id="im_2" alt="toggle" width="11" height="11" /></a>
<a href="java script:exp_coll(2);">
<img src="images/public/folder.open.gif" border='0' id="im2_2" alt="icon"/></a>
                2.
                </p>
<ul class="zzul" id="sp_2" style="display:block;">
<script type="text/javascript">
  ind = 2;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }
</script>
           
<li>
<a href="java script:exp_coll(200);">
<img src="images/public/minus.gif" border='0' id="im_200" alt="toggle" /></a>
<a href="java script:exp_coll(200);"><img src="images/public/folder.open.gif" border='0' id="im2_200" alt="icon"/></a>
&#160;
2.1
<ul class="zzul" id="sp_200" style="display:block;">
<script type="text/javascript">
  ind = 200;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }
</script>
           
<li><span class="zzspace">&#160;<img src="images/public/layout.gif" alt="icon"/>&#160;<a href="adp/help/1000.html">4543</a></span></li>
<li><span class="zzspace">&#160;<img src="images/public/layout.gif" alt="icon"/>&#160;<a href="adp/help/3000.html">3000.html</a></span></li>       
           




</ul>
</li>
<li>
               
               
               

<a href="java script:exp_coll(201);">
<img src="images/public/minus.gif" border='0' id="im_201" alt="toggle" /></a>
<a href="java script:exp_coll(201);"><img src="images/public/folder.open.gif" border='0' id="im2_201" alt="icon"/></a>
&#160;
2.2
<ul class="zzul" id="sp_201" style="display:block;">

<script type="text/javascript">
  ind = 201;
  x = document.getElementById("sp_" + ind);
  x.style.display = 'none';
  if (x.style.display == 'none')
  {
    document.getElementById("im_" + ind).src = "images/public/plus.gif";
    document.getElementById("im2_" + ind).src = "images/public/folder.gif";
  }
</script>
           
<li><span class="zzspace">&#160;<img src="images/public/layout.gif" alt="icon"/>&#160;<a href="adp/help/1000.html">4543</a></span></li>
<li><span class="zzspace">&#160;<img src="images/public/layout.gif" alt="icon"/>&#160;<a href="adp/help/3000.html">3000.html</a></span></li>


</ul>
</li>
</ul>
</ul>
</body>
</html>
Avatar billede mm12010 Nybegynder
15. april 2004 - 10:01 #1
prøv at erstatte linie 70-202 med disse:

indArr = new Array(1,2,200,201);
function coll_all(){
  for(i=0;i<indArr.length;i++){
    x = document.getElementById("sp_" + indArr[i]);
    x.style.display = 'none';
    if (x.style.display == 'none'){
      document.getElementById("im_" + indArr[i]).src = "images/public/plus.gif";
      document.getElementById("im2_" + indArr[i]).src = "images/public/folder.gif";
    }
  }
}
function exp_all(){
  for(i=0;i<indArr.length;i++){
    x = document.getElementById("sp_" + indArr[i]);
    x.style.display = 'block';
    if (x.style.display == 'block'){
      document.getElementById("im_" + ind).src = "images/public/minus.gif";
      document.getElementById("im2_" + ind).src = "images/public/folder.open.gif";
    }
  }
}

problemet var at du prøvede at tilgå og ændre egenskaber for elementer (3,4,5) som ikke fandtes på siden
Avatar billede intel4ever Nybegynder
15. april 2004 - 13:46 #2
mange tak men jeg løste det selv jeg manglede at afslutte 'function exp_all()'

og ja det ville være en god ide at bruge array istedet for at kopiere du må gerne få de 200 point bare skriv et svar
Avatar billede mm12010 Nybegynder
15. april 2004 - 13:50 #3
selv tak - men behold bare nogen af dem selv, 200 er lige rigeligt for sådan et spg :o)
Avatar billede intel4ever Nybegynder
15. april 2004 - 13:58 #4
måske, men nu skal jeg også til at flette noget asp og sql ind i det, så bliver det meget værer.
Avatar billede intel4ever Nybegynder
15. april 2004 - 14:01 #5
jeg er kun glad for at give lidt point ud for at få mine små problemer løst, det er skam en stor hjælp
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester

Seneste spørgsmål Seneste aktivitet
I dag 10:21 Ny printer, men hvilken Af mort1 i Printere
I går 19:41 USB på Linux Af Uvanga i Linux
12/0818:26 Hvilken type mus Af mort1 i PC
11/0813:21 ms Forms Af leahcim i Andet software
10/0821:30 Blokeret på Snapchat? Af LineP i Chat & Messaging