on mouseover in treemenu
Ik zou willen dat er bij een on mouseover ook iets verschijnt, probleem is dat ik niet waar ik dit kan invoegen.
dit is mijn dynamisch opgebouwde treemenu structuur
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
//ini_set('display_errors', 1); // 0 = uit, 1 = aan
//error_reporting(E_ALL);
$lang_id = $_REQUEST['lang'];
include_once $_SERVER["DOCUMENT_ROOT"]."/new_site_v2/includes/connect.php";
include_once $_SERVER["DOCUMENT_ROOT"]."/new_site_v2/site2/menu/treemenu/TreeMenu.php";
$icon = "folder.gif";
$expandedIcon = "folder-expanded.gif";
$menu = new HTML_TreeMenu();
$query = "SELECT id, name FROM menu order by ranking ASC";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$menu_id=$row['id'];
${"node1".$menu_id} = new HTML_TreeNode(array( 'text' => $row['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu&topitem=&subitem=&machine=&info=",
'icon' => $icon,
'expandedIcon' => $expandedIcon,
'expanded' => true)
);
$query = "SELECT submenu_id FROM MENU_SUBMENU WHERE menu_id=$menu_id";
$resul = mysql_query($query) or die(mysql_error());
while($ro = mysql_fetch_array($resul, MYSQL_ASSOC)){
$submenu_id=$ro['submenu_id'];
$query = "SELECT name FROM SUBMENU WHERE id=$submenu_id";
$resu = mysql_query($query) or die(mysql_error());
while($r = mysql_fetch_array($resu, MYSQL_ASSOC)){
${"node1".$menu_id."_1"} = &${"node1".$menu_id}->addItem(new HTML_TreeNode(array( 'text' => $r['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu=".$submenu_id."&topitem=&subitem=&machine=&info=",
'icon' => $icon,
'expandedIcon' => $expandedIcon)
));
$query = "SELECT topitem_id FROM SUBMENU_TOPITEM WHERE submenu_id=$submenu_id";
$res = mysql_query($query) or die(mysql_error());
while($a = mysql_fetch_array($res, MYSQL_ASSOC)){
$topitem_id=$a['topitem_id'];
$query = "SELECT name FROM TOPITEM WHERE id=$topitem_id";
$re = mysql_query($query) or die(mysql_error());
while($z = mysql_fetch_array($re, MYSQL_ASSOC)){
${"node1".$menu_id."_1_1"} = &${"node1".$menu_id."_1"}->addItem(new HTML_TreeNode(array('text' => $z['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu=".$submenu_id."&topitem=".$topitem_id."&subitem=&machine=&info=",
'icon' => $icon,
'expandedIcon' => $expandedIcon)
));
$query = "SELECT subitem_id FROM TOPITEM_SUBITEM WHERE topitem_id=$topitem_id";
$r = mysql_query($query) or die(mysql_error());
while($e = mysql_fetch_array($r, MYSQL_ASSOC)){
$subitem_id=$e['subitem_id'];
$query = "SELECT name FROM SUBITEM WHERE id=$subitem_id";
$t = mysql_query($query) or die(mysql_error());
while($y = mysql_fetch_array($t, MYSQL_ASSOC)){
${"node1".$menu_id."_1_1_1"} = &${"node1".$menu_id."_1_1"}->addItem(new HTML_TreeNode(array('text' => $y['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu=".$submenu_id."&topitem=".$topitem_id."&subitem=".$subitem_id."&machine=&info=",
'icon' => $icon,
'expandedIcon' => $expandedIcon)
));
$query = "SELECT machine_id FROM SUBITEM_MACHINE WHERE subitem_id=$subitem_id";
$p = mysql_query($query) or die(mysql_error());
while($l = mysql_fetch_array($p, MYSQL_ASSOC)){
$machine_id=$l['machine_id'];
$query = "SELECT name FROM MACHINE WHERE id=$machine_id";
$w = mysql_query($query) or die(mysql_error());
while($n = mysql_fetch_array($w, MYSQL_ASSOC)){
${"node1".$menu_id."_1_1_1_1"} =&${"node1".$menu_id."_1_1_1"}->addItem(new HTML_TreeNode(array('text' => $n['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu=".$submenu_id."&topitem=".$topitem_id."&subitem=".$subitem_id."&machine=".$machine_id."&info=",
'icon' => $icon,
'expandedIcon' => $expandedIcon)
));
$query = "SELECT info_id FROM MACHINE_INFO WHERE machine_id=$machine_id";
$d = mysql_query($query) or die(mysql_error());
while($f = mysql_fetch_array($d, MYSQL_ASSOC)){
$info_id=$f['info_id'];
$query = "SELECT name FROM INFO WHERE id=$info_id";
$g = mysql_query($query) or die(mysql_error());
while($f = mysql_fetch_array($g, MYSQL_ASSOC)){
${"node1".$menu_id."_1_1_1_1_1"} =&${"node1".$menu_id."_1_1_1_1"}->addItem(new HTML_TreeNode(array('text' => $f['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu=".$submenu_id."&topitem=".$topitem_id."&subitem=".$subitem_id."&machine=".$machine_id."&info=".$info_id."",
'icon' => $icon,
'expandedIcon' => $expandedIcon,
'cssClass' => 'treeMenuBold')
));
}
}
}
}
}
}
}
}
}
}
$menu->addItem(${"node1".$menu_id});
}
// Create the presentation class
$treeMenu = &new HTML_TreeMenu_DHTML($menu, array('images' => 'http://www.haco.com/new_site_v2/site2/menu/treemenu/imagesalt2', 'defaultClass' => 'treeMenuDefault'));
?>
<html>
<head>
<script src="http://www.haco.com/new_site_v2/site2/menu/treemenu/TreeMenu.js" language="JavaScript" type="text/javascript"></script>
</head>
<body>
<?php $treeMenu->printMenu()?><br /><br />
</body>
</html>
//ini_set('display_errors', 1); // 0 = uit, 1 = aan
//error_reporting(E_ALL);
$lang_id = $_REQUEST['lang'];
include_once $_SERVER["DOCUMENT_ROOT"]."/new_site_v2/includes/connect.php";
include_once $_SERVER["DOCUMENT_ROOT"]."/new_site_v2/site2/menu/treemenu/TreeMenu.php";
$icon = "folder.gif";
$expandedIcon = "folder-expanded.gif";
$menu = new HTML_TreeMenu();
$query = "SELECT id, name FROM menu order by ranking ASC";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$menu_id=$row['id'];
${"node1".$menu_id} = new HTML_TreeNode(array( 'text' => $row['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu&topitem=&subitem=&machine=&info=",
'icon' => $icon,
'expandedIcon' => $expandedIcon,
'expanded' => true)
);
$query = "SELECT submenu_id FROM MENU_SUBMENU WHERE menu_id=$menu_id";
$resul = mysql_query($query) or die(mysql_error());
while($ro = mysql_fetch_array($resul, MYSQL_ASSOC)){
$submenu_id=$ro['submenu_id'];
$query = "SELECT name FROM SUBMENU WHERE id=$submenu_id";
$resu = mysql_query($query) or die(mysql_error());
while($r = mysql_fetch_array($resu, MYSQL_ASSOC)){
${"node1".$menu_id."_1"} = &${"node1".$menu_id}->addItem(new HTML_TreeNode(array( 'text' => $r['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu=".$submenu_id."&topitem=&subitem=&machine=&info=",
'icon' => $icon,
'expandedIcon' => $expandedIcon)
));
$query = "SELECT topitem_id FROM SUBMENU_TOPITEM WHERE submenu_id=$submenu_id";
$res = mysql_query($query) or die(mysql_error());
while($a = mysql_fetch_array($res, MYSQL_ASSOC)){
$topitem_id=$a['topitem_id'];
$query = "SELECT name FROM TOPITEM WHERE id=$topitem_id";
$re = mysql_query($query) or die(mysql_error());
while($z = mysql_fetch_array($re, MYSQL_ASSOC)){
${"node1".$menu_id."_1_1"} = &${"node1".$menu_id."_1"}->addItem(new HTML_TreeNode(array('text' => $z['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu=".$submenu_id."&topitem=".$topitem_id."&subitem=&machine=&info=",
'icon' => $icon,
'expandedIcon' => $expandedIcon)
));
$query = "SELECT subitem_id FROM TOPITEM_SUBITEM WHERE topitem_id=$topitem_id";
$r = mysql_query($query) or die(mysql_error());
while($e = mysql_fetch_array($r, MYSQL_ASSOC)){
$subitem_id=$e['subitem_id'];
$query = "SELECT name FROM SUBITEM WHERE id=$subitem_id";
$t = mysql_query($query) or die(mysql_error());
while($y = mysql_fetch_array($t, MYSQL_ASSOC)){
${"node1".$menu_id."_1_1_1"} = &${"node1".$menu_id."_1_1"}->addItem(new HTML_TreeNode(array('text' => $y['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu=".$submenu_id."&topitem=".$topitem_id."&subitem=".$subitem_id."&machine=&info=",
'icon' => $icon,
'expandedIcon' => $expandedIcon)
));
$query = "SELECT machine_id FROM SUBITEM_MACHINE WHERE subitem_id=$subitem_id";
$p = mysql_query($query) or die(mysql_error());
while($l = mysql_fetch_array($p, MYSQL_ASSOC)){
$machine_id=$l['machine_id'];
$query = "SELECT name FROM MACHINE WHERE id=$machine_id";
$w = mysql_query($query) or die(mysql_error());
while($n = mysql_fetch_array($w, MYSQL_ASSOC)){
${"node1".$menu_id."_1_1_1_1"} =&${"node1".$menu_id."_1_1_1"}->addItem(new HTML_TreeNode(array('text' => $n['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu=".$submenu_id."&topitem=".$topitem_id."&subitem=".$subitem_id."&machine=".$machine_id."&info=",
'icon' => $icon,
'expandedIcon' => $expandedIcon)
));
$query = "SELECT info_id FROM MACHINE_INFO WHERE machine_id=$machine_id";
$d = mysql_query($query) or die(mysql_error());
while($f = mysql_fetch_array($d, MYSQL_ASSOC)){
$info_id=$f['info_id'];
$query = "SELECT name FROM INFO WHERE id=$info_id";
$g = mysql_query($query) or die(mysql_error());
while($f = mysql_fetch_array($g, MYSQL_ASSOC)){
${"node1".$menu_id."_1_1_1_1_1"} =&${"node1".$menu_id."_1_1_1_1"}->addItem(new HTML_TreeNode(array('text' => $f['name'],
'link' => "index.php?lang=".$lang_id."&menu=".$menu_id."&submenu=".$submenu_id."&topitem=".$topitem_id."&subitem=".$subitem_id."&machine=".$machine_id."&info=".$info_id."",
'icon' => $icon,
'expandedIcon' => $expandedIcon,
'cssClass' => 'treeMenuBold')
));
}
}
}
}
}
}
}
}
}
}
$menu->addItem(${"node1".$menu_id});
}
// Create the presentation class
$treeMenu = &new HTML_TreeMenu_DHTML($menu, array('images' => 'http://www.haco.com/new_site_v2/site2/menu/treemenu/imagesalt2', 'defaultClass' => 'treeMenuDefault'));
?>
<html>
<head>
<script src="http://www.haco.com/new_site_v2/site2/menu/treemenu/TreeMenu.js" language="JavaScript" type="text/javascript"></script>
</head>
<body>
<?php $treeMenu->printMenu()?><br /><br />
</body>
</html>
ik heb nog 2 files namelijk treemenu.js en treemenu.php waarnaar ik verwijs in mijn vorig script. Wanneer je dit nodig vindt dan post ik het ook.
Alvast bedankt voor de hulp
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var layerTag = this.doesMenu() ? this.stringFormat('<div id="{0}" style="display: {1}" class="{2}">', layerID, visibility, (nodes[i].cssClass ? nodes[i].cssClass : this.defaultClass)) : this.stringFormat('<div class="{0}">', nodes[i].cssClass ? nodes[i].cssClass : this.defaultClass);
var onMDown = this.doesMenu() && nodes[i].n.length && nodes[i].isDynamic ? this.stringFormat('onmousedown="{0}.toggleBranch(\'{1}\', true)" style="cursor: pointer; cursor: hand"', this.myname, layerID) : '';
var imgTag = this.stringFormat('<img src="{0}/{1}{2}.gif" width="20" height="20" align="top" border="0" name="img_{3}" {4}>', this.iconpath, gifname, modifier, layerID, onMDown);
var linkTarget= nodes[i].linkTarget ? nodes[i].linkTarget : this.linkTarget;
var linkStart = nodes[i].link ? this.stringFormat('<a href="{0}" target="{1}">', nodes[i].link, linkTarget) : '';
var linkEnd = nodes[i].link ? '</a>' : '';
this.output += this.stringFormat('{0}<nobr>{1}{2}{3}{4}<span {5}>{6}</span>{7}</nobr><br></div>',
layerTag,
prepend,
linkStart,
parentLayerID == null && (nodes.length == 1 || this.noTopLevelImages) ? '' : imgTag,
iconimg,
eventHandlers,
nodes[i].title,
linkEnd);
var onMDown = this.doesMenu() && nodes[i].n.length && nodes[i].isDynamic ? this.stringFormat('onmousedown="{0}.toggleBranch(\'{1}\', true)" style="cursor: pointer; cursor: hand"', this.myname, layerID) : '';
var imgTag = this.stringFormat('<img src="{0}/{1}{2}.gif" width="20" height="20" align="top" border="0" name="img_{3}" {4}>', this.iconpath, gifname, modifier, layerID, onMDown);
var linkTarget= nodes[i].linkTarget ? nodes[i].linkTarget : this.linkTarget;
var linkStart = nodes[i].link ? this.stringFormat('<a href="{0}" target="{1}">', nodes[i].link, linkTarget) : '';
var linkEnd = nodes[i].link ? '</a>' : '';
this.output += this.stringFormat('{0}<nobr>{1}{2}{3}{4}<span {5}>{6}</span>{7}</nobr><br></div>',
layerTag,
prepend,
linkStart,
parentLayerID == null && (nodes.length == 1 || this.noTopLevelImages) ? '' : imgTag,
iconimg,
eventHandlers,
nodes[i].title,
linkEnd);
dit komt uit de treemenu.js waar de treemenu eignelijk wordt opgebouwd
Maar de grote vraag is nu hoe ik die onmouseover daar kan bij krijgen?
Bumpen::
SanThe.