Homepage selbermachen 7.846 Themen, 35.563 Beiträge

Verzeichnisbaum - Verweise?

bloody-2002 / 5 Antworten / Flachansicht Nickles

hey leute,


ich hab mal ne frage und zwar. ich hab da ein verzeichnisbaum zur navigation erstellt und jetzt weiß ich nicht, wie ich die verweise einbinden kann, benutze nämlich frames. weiß jemand wie ich das machen könnte? hier der code:


  <script type="text/javascript">
                <!--
                var Tree = new Array;
                // nodeId | parentNodeId | nodeName | nodeUrl
                Tree[0]  = "1|0|About Us|#";
                Tree[1]  = "2|1|1. Mannschaft|aboutus/#
                Tree[2]  = "3|1|2. Mannschaft|aboutus/#";


                Tree[3]  = "4|0|Aktuelles|aktuelles/#";


                Tree[4]  = "5|0|Anfahrt|anfahrt/#";


                Tree[5]  = "6|0|Ergebnisse|#";
                Tree[6]  = "7|6|2002/2003|#";
                Tree[7]  = "8|7|1. Mannschaft|#";
                Tree[8]  = "9|7|2. Mannschaft|#";
                Tree[9]  = "10|7|Schueler Mannschaft|#";
                Tree[10]  = "11|6|2001/2002|#";
                Tree[11]  = "12|11|1. Mannschaft|#";
                Tree[12]  = "13|11|2. Mannschaft|#";
                Tree[13]  = "14|11|Schueler Mannschaft|#";


                Tree[14]  = "15|0|Spielbetrieb|#";
                Tree[15]  = "16|15|Aufstellungen|#";
                Tree[16]  = "17|16|2002/2003|#";
                Tree[17]  = "18|17|1. Mannschaft|#";
                Tree[18]  = "19|17|2. Mannschaft|#";
                Tree[19]  = "20|17|Schueler Mannschaft|#";
                Tree[20]  = "21|16|2001/2002|#";
                Tree[21]  = "22|21|1. Mannschaft|#";
                Tree[22]  = "23|21|2. Mannschaft|#";
                Tree[23]  = "24|21|Schueler Mannschaft|#";
                Tree[24]  = "25|15|Training|#";


                Tree[25]  = "26|0|Downloads|#";
                Tree[26]  = "27|26|Ergebnisse|#";
                Tree[27]  = "28|27|2002/2003|#";
                Tree[28]  = "29|27|2001/2002|#";
                Tree[29]  = "30|26|Sonstiges|#";


                Tree[30]  = "31|0|Photos|#";
                Tree[31]  = "32|31|2002|#";
                Tree[32]  = "33|32|Filmnacht|#";
                Tree[33]  = "34|32|Freundschaftstunier|#";
                Tree[34]  = "35|32|Jedermannstunier|#";
                Tree[35]  = "36|32|Mannschaften|#";
                Tree[36]  = "37|32|Spiele|#";
                Tree[37]  = "38|32|Training|#";


                Tree[38]  = "39|0|Feedback|#";
                Tree[39]  = "40|39|Forum|#";
                Tree[40]  = "41|39|Guestbook|#";


                Tree[41]  = "42|0|Links|#";
                Tree[42]  = "43|42|Tischtennis|#";
                Tree[43]  = "44|43|Ergebnisse & Tabellen|#";
                Tree[44]  = "45|44|Kreisklasse A Gruppe 2|#";
                Tree[45]  = "46|44|Kreisklasse C Gruppe 2|#";
                Tree[46]  = "47|43|Vereine|#";
                Tree[47]  = "48|47|TSV Kusterdingen|#";
                Tree[48]  = "49|47|TTC Ergenzingen|#";
                Tree[49]  = "50|47|SV Weilheim|#";
                Tree[50]  = "51|43|Verbaende|#";
                Tree[51]  = "52|51|Bezirk Alb|#";
                Tree[52]  = "53|51|TTVWH|#";
                Tree[53]  = "54|51|DTTB|#";


                Tree[54]  = "55|0|Contact Us|#";


                Tree[55]  = "56|0|Reload|#";


                //-->
        </script>

bei Antwort benachrichtigen
xafford bloody-2002 „hier das skript: // Arrays for nodes and icons var nodes new Array var openNodes...“
Optionen

mit dem geänderten code hier sollte es gehen, einfach an deine elemente zusätzlich noch mit |_blank oder |framename den namen des zielframes anhängen:


var Tree = new Array;
// nodeId | parentNodeId | nodeName | nodeUrl
Tree[0] = "1|0|About Us|#";
Tree[1] = "2|1|1. Mannschaft|aboutus/#|_blank";
Tree[2] = "3|1|2. Mannschaft|aboutus/#|_blank";
Tree[3] = "4|0|Aktuelles|aktuelles/#";
Tree[4] = "5|0|Anfahrt|anfahrt/#";
Tree[5] = "6|0|Ergebnisse|#";
Tree[6] = "7|6|2002/2003|#";
Tree[7] = "8|7|1. Mannschaft|#";
Tree[8] = "9|7|2. Mannschaft|#";
Tree[9] = "10|7|Schueler Mannschaft|#";
Tree[10] = "11|6|2001/2002|#";
Tree[11] = "12|11|1. Mannschaft|#";
Tree[12] = "13|11|2. Mannschaft|#";
Tree[13] = "14|11|Schueler Mannschaft|#";
Tree[14] = "15|0|Spielbetrieb|#";
Tree[15] = "16|15|Aufstellungen|#";
Tree[16] = "17|16|2002/2003|#";
Tree[17] = "18|17|1. Mannschaft|#";
Tree[18] = "19|17|2. Mannschaft|#";
Tree[19] = "20|17|Schueler Mannschaft|#";
Tree[20] = "21|16|2001/2002|#";
Tree[21] = "22|21|1. Mannschaft|#";
Tree[22] = "23|21|2. Mannschaft|#";
Tree[23] = "24|21|Schueler Mannschaft|#";
Tree[24] = "25|15|Training|#";
Tree[25] = "26|0|Downloads|#";
Tree[26] = "27|26|Ergebnisse|#";
Tree[27] = "28|27|2002/2003|#";
Tree[28] = "29|27|2001/2002|#";
Tree[29] = "30|26|Sonstiges|#";
Tree[30] = "31|0|Photos|#";
Tree[31] = "32|31|2002|#";
Tree[32] = "33|32|Filmnacht|#";
Tree[33] = "34|32|Freundschaftstunier|#";
Tree[34] = "35|32|Jedermannstunier|#";
Tree[35] = "36|32|Mannschaften|#";
Tree[36] = "37|32|Spiele|#";
Tree[37] = "38|32|Training|#";
Tree[38] = "39|0|Feedback|#";
Tree[39] = "40|39|Forum|#";
Tree[40] = "41|39|Guestbook|#";
Tree[41] = "42|0|Links|#";
Tree[42] = "43|42|Tischtennis|#";
Tree[43] = "44|43|Ergebnisse & Tabellen|#";
Tree[44] = "45|44|Kreisklasse A Gruppe 2|#";
Tree[45] = "46|44|Kreisklasse C Gruppe 2|#";
Tree[46] = "47|43|Vereine|#";
Tree[47] = "48|47|TSV Kusterdingen|#";
Tree[48] = "49|47|TTC Ergenzingen|#";
Tree[49] = "50|47|SV Weilheim|#";
Tree[50] = "51|43|Verbaende|#";
Tree[51] = "52|51|Bezirk Alb|#";
Tree[52] = "53|51|TTVWH|#";
Tree[53] = "54|51|DTTB|#";
Tree[54] = "55|0|Contact Us|#";
Tree[55] = "56|0|Reload|#";
// Arrays for nodes and icons
var nodes = new Array();;
var openNodes = new Array();
var icons = new Array(6);
// Loads all icons that are used in the tree
function preloadIcons() {
icons[0] = new Image();
icons[0].src = "img/plus.gif";
icons[1] = new Image();
icons[1].src = "img/plusbottom.gif";
icons[2] = new Image();
icons[2].src = "img/minus.gif";
icons[3] = new Image();
icons[3].src = "img/minusbottom.gif";
icons[4] = new Image();
icons[4].src = "img/folder.gif";
icons[5] = new Image();
icons[5].src = "img/folderopen.gif";
}
// Create the tree

function createTree(arrName, startNode, openNode)
{
nodes = arrName;
if (nodes.length > 0)
{
preloadIcons();
if (startNode == null) startNode = 0;
if (openNode != 0 || openNode != null) setOpenNodes(openNode);
if (startNode !=0)
{
var nodeValues = nodes[getArrayId(startNode)].split("|");
document.write("<a href=\"" + nodeValues[3] + "\""+getTarget(nodeValues[4])+" onmouseover=\"window.status='" + nodeValues[2] + "';return true;\" onmouseout=\"window.status=' ';return true;\"><img src=\"img/folderopen.gif\" align=\"absbottom\" alt=\"\" />" + nodeValues[2] + "</a>");
} else document.write("<img src=\"img/base.gif\" align=\"absbottom\" alt=\"\" />TT - SV Seebronn");
var recursedNodes = new Array();
addNode(startNode, recursedNodes);
}
}
// Returns the position of a node in the array
function getArrayId(node)
{
for (i=0; i<nodes.length; i++)
{
var nodeValues = nodes[i].split("|");
if (nodeValues[0]==node) return i;
}
}
// Get the targets for the anchors
function getTarget(value)
{
if(value!=null)
{
var target=" target=\""+value+"\"";
}
else
{
var target="";
}
return target;
}
// Puts in array nodes that will be open
function setOpenNodes(openNode)
{
for (i=0; i<nodes.length; i++) {
var nodeValues = nodes[i].split("|");
if (nodeValues[0]==openNode)
{
openNodes.push(nodeValues[0]);
setOpenNodes(nodeValues[1]);
}
}
}
// Checks if a node is open
function isNodeOpen(node)
{
for (i=0; i<openNodes.length; i++)
if (openNodes[i]==node) return true;
return false;
}
// Checks if a node has any children
function hasChildNode(parentNode)
{
for (i=0; i< nodes.length; i++)
{
var nodeValues = nodes[i].split("|");
if (nodeValues[1] == parentNode) return true;
}
return false;
}
// Checks if a node is the last sibling
function lastSibling (node, parentNode)
{
var lastChild = 0;
for (i=0; i< nodes.length; i++)
{
var nodeValues = nodes[i].split("|");
if (nodeValues[1] == parentNode)
lastChild = nodeValues[0];
}
if (lastChild==node) return true;
return false;
}
// Adds a new node in the tree
function addNode(parentNode, recursedNodes)
{
for (var i = 0; i < nodes.length; i++)
{
var nodeValues = nodes[i].split("|");
if (nodeValues[1] == parentNode)
{
var ls = lastSibling(nodeValues[0], nodeValues[1]);
var hcn = hasChildNode(nodeValues[0]);
var ino = isNodeOpen(nodeValues[0]);
// Write out line & empty icons
for (g=0; g<recursedNodes.length; g++)
{
if (recursedNodes[g] == 1) document.write("<img src=\"img/line.gif\" align=\"absbottom\" alt=\"\" />");
else document.write("<img src=\"img/empty.gif\" align=\"absbottom\" alt=\"\" />");
}
// put in array line & empty icons
if (ls) recursedNodes.push(0);
else recursedNodes.push(1);
// Write out join icons
if (hcn)
{
if (ls)
{
document.write("<a href=\"javascript: oc(" + nodeValues[0] + ", 1);\"><img id=\"join" + nodeValues[0] + "\" src=\"img/");
if (ino) document.write("minus");
else document.write("plus");
document.write("bottom.gif\" align=\"absbottom\" alt=\"Open/Close node\" /></a>");
}
else
{
document.write("<a href=\"javascript: oc(" + nodeValues[0] + ", 0);\"><img id=\"join" + nodeValues[0] + "\" src=\"img/");
if (ino) document.write("minus");
else document.write("plus");
document.write(".gif\" align=\"absbottom\" alt=\"Open/Close node\" /></a>");
}
}
else
{
if (ls) document.write("<img src=\"img/join.gif\" align=\"absbottom\" alt=\"\" />");
else document.write("<img src=\"img/joinbottom.gif\" align=\"absbottom\" alt=\"\" />");
}
// Start link
document.write("<a href=\"" + nodeValues[3] + "\""+getTarget(nodeValues[4])+" onmouseover=\"window.status='" + nodeValues[2] + "';return true;\" onmouseout=\"window.status=' ';return true;\">");
// Write out folder & page icons
if (hcn)
{
document.write("<img id=\"icon" + nodeValues[0] + "\" src=\"img/folder")
if (ino) document.write("open");
document.write(".gif\" align=\"absbottom\" alt=\"Folder\" />");
}
else document.write("<img id=\"icon" + nodeValues[0] + "\" src=\"img/page.gif\" align=\"absbottom\" alt=\"Page\" />");
// Write out node name
document.write(nodeValues[2]);
// End link
document.write("</a>");
// If node has children write out divs and go deeper
if (hcn)
{
document.write("<div id=\"div" + nodeValues[0] + "\"");
if (!ino) document.write(" style=\"display: none;\"");
document.write(">");
addNode(nodeValues[0], recursedNodes);
document.write("</div>");
}
// remove last line or empty icon
recursedNodes.pop();
}
}
}
// Opens or closes a node
function oc(node, bottom)
{
var theDiv = document.getElementById("div" + node);
var theJoin = document.getElementById("join" + node);
var theIcon = document.getElementById("icon" + node);
if (theDiv.style.display == 'none') {
if (bottom==1) theJoin.src = icons[3].src;
else theJoin.src = icons[2].src;
theIcon.src = icons[5].src;
theDiv.style.display = '';
}
else
{
if (bottom==1) theJoin.src = icons[1].src;
else theJoin.src = icons[0].src;
theIcon.src = icons[4].src;
theDiv.style.display = 'none';
}
}
// Push and pop not implemented in IE(crap! don´t know about NS though)
if(!Array.prototype.push)
{
function array_push()
{
for(var i=0;i<arguments.length;i++)
this[this.length]=arguments[i];
return this.length;
}
Array.prototype.push = array_push;
}
if(!Array.prototype.pop)
{
function array_pop()
{
lastElement = this[this.length-1];
this.length = Math.max(this.length-1,0);
return lastElement;
}
Array.prototype.pop = array_pop;
}
Pauschalurteile sind immer falsch!!!
bei Antwort benachrichtigen
macht 200€ o cu X xafford