mam rozwijane menu w postaci drzewa. problem pojawia sie gdy chce wybrac inna pozycje z menu (np. link mapa.html)nie bedace w podmenu tego drzewa (1.html, 2.html, 3.html). co zrobic aby po wyborze drzewo zawierajce wymienione pozycje chowalo sie?

ponizej kod pliku menu
  1. <script type="text/javascript" src="tree.js"></script>
  2.  
  3. <body bgcolor="black"><font color="white">
  4. <ul id="tree0" class="tree">
  5.  
  6. <li><a class="menu_link" href="mapa.html" style="color:white" target="zmienna">Strona główna</a></li>
  7.  
  8.  
  9. <li><a href="tabela.html" style="color:red" target="zmienna">dane</a></li>
  10. <li><a href=#1>Archiwum</a>
  11.  
  12. <ul>
  13. <li> <a href="1.html" style="color:yellow" target="zmienna"> opcja1 </a> </li>
  14. <li> <a href="2.html" style="color:blue" target="zmienna">opcja2</a> </li>
  15. <li> <a href="3.html" style="color:green" target="zmienna"> opcja3</a> </li>
  16. </ul>
  17. </li>
  18. <font color="white">
  19. <li><a href="galeria/galeria.html" style="color:red" style="color:white" target="zmienna">Galeria</a></li>
  20.  
  21. </ul>
  22.  
  23. <script type="text/javascript">
  24. <!--
  25. new tree("tree0");
  26. //-->


tutaj zas jest skrypt js do ktorego odwoluja sie linki podmenu. w kodzie znajduje sie odwolanie do gifow, ale ja akurat nie korzystam z tego.

  1. function tree(id)
  2. {
  3. this.id = id;
  4.  
  5. this.click = function ()
  6. {
  7. for (var i = 0, el_node; i < this.parentNode.childNodes.length; i++)
  8. {
  9. el_node = this.parentNode.childNodes.item(i)
  10. if (el_node.nodeName.toLowerCase() == 'ul')
  11. {
  12. el_node.style.display = el_node.style.display == 'none' ? 'block' : 'none';
  13. this.parentNode.style.backgroundImage = 'url("' + (el_node.style.display == 'none' ? 'closed' : 'opened') + '.gif")';
  14. return;
  15. }
  16. }
  17. }
  18.  
  19. this.start = function (el)
  20. {
  21. for (var i = 0, el_node; i < el.childNodes.length; i++)
  22. {
  23. el_node = el.childNodes.item(i);
  24. if (el_node.nodeName.toLowerCase() == 'a')
  25. {
  26. el_node.onclick = this.click;
  27. for (var j = 0; j < el_node.parentNode.childNodes.length; j++)
  28. {
  29. if (el_node.parentNode.childNodes.item(j).nodeName.toLowerCase() == 'ul')
  30. {
  31. el_node.parentNode.style.backgroundImage = 'url("closed.gif")';
  32. el_node.className = (el_node.className ? el_node.className + ' ' : '') + 'folder';
  33. break;
  34. }
  35. if (el_node.parentNode.childNodes.item(j).nodeName.toLowerCase() == 'li') break;
  36. }
  37. if (el_node.href && unescape(el_node.href) == unescape(window.location.href))
  38. {
  39. el_node.className = 'active';
  40. var el_parentNode = el_node;
  41. do
  42. {
  43. el_parentNode = el_parentNode.parentNode;
  44. if (el_parentNode.nodeName.toLowerCase() == 'ul')
  45. {
  46. el_parentNode.style.display = 'block';
  47. if (document.getElementById(this.id) != el_parentNode) el_parentNode.parentNode.style.backgroundImage = 'url("opened.gif")';
  48. }
  49. }
  50. while (document.getElementById(this.id) != el_parentNode)
  51. }
  52. }
  53. else if (el_node.nodeName.toLowerCase() == 'ul') el_node.style.display = 'none';
  54. this.start(el_node);
  55. }
  56. }
  57.  
  58. if (document.getElementById && document.childNodes)
  59. {
  60. if (document.images)
  61. {
  62. new Image().src = 'opened.gif';
  63. new Image().src = 'document.gif';
  64. }
  65. this.start(document.getElementById(this.id));
  66. }
  67. }