I try to build a tree menu.
The idea is that the submenu is in a hidden absolute position table. By
clicking the folder.gif, the submenu table switces to visible - static,
so opens.
This helps me to put the tree anywhere in a page, and not in x,y position.
It works fine in IE but not in Netscape or Firefox.
Can someone please help me to fix ??
Here is the code :
<html>
<head>
</head>
<script language=javascript>
function viewsub(){
if (view.type == "off"){
view.type="on";
view.style.visibility="visible";
view.style.position="static";
} else {
view.type="off";
view.style.visibility="hidden";
view.style.position="absolute";
}
}
</script>
<body>
<table cellpadding=1 cellspacing=0 border=1>
<td><img src=folder.gif onclick=viewsub()>Open folder
<table border=0 cellpadding=1 cellspacing=0 id="view" type=off
width=95% style="visibility: hidden; position:absolute; left: 0; top: 0">
<td>Sub link</td>
</table>
</td></table>
</body>
</html>
> [...]
> It works fine in IE but not in Netscape or Firefox.
[quoted text clipped - 16 lines]
> } else {
> view.type="off";
Again, host objects should not be used as data containers
if this required the augmentation with new properties.
It is not necessary here anyway, one can test against the
value of the `visibility' or `display' property instead.
> view.style.visibility="hidden";
> view.style.position="absolute";
Use `display' instead of `visibility' and `position'.
> }
>
[quoted text clipped - 15 lines]
> </body>
> </html>
<URL:http://validator.w3.org/>
<URL:http://jigsaw.w3.org/css-validator/>
And don't use tables; use lists.
A tree made out of a list:
<URL:http://javascripttoolbox.com/lib/mktree/>
A tree with dynamically created branches:
<URL:http://pointedears.de/ObjectInspector>
(look into the showProperties() method in objinsp.js;
a TreeView library based on this is under construction)
PointedEars