Template:Team:Paris Saclay/incl menu
From 2013.igem.org
(Difference between revisions)
(var ke) |
(var ke) |
||
Line 13: | Line 13: | ||
} | } | ||
- | function mnu_node(mnu, level= 0, | + | function mnu_node(mnu, level= 0, parent= undefined) |
{ | { | ||
var sn= mnu.childNodes; | var sn= mnu.childNodes; | ||
var lastitem= undefined; | var lastitem= undefined; | ||
- | if(mnu.nodeName | + | if(mnu.nodeName == "SPAN") //sous-menu |
{ | { | ||
- | mnu.style.display= "none"; | + | if(parent == undefined) //pas de parent : afficher dans tous les cas |
+ | { | ||
+ | mnu.style.display= "block"; | ||
+ | } | ||
+ | else //a un parent | ||
+ | { | ||
+ | mnu.style.display= "none"; | ||
+ | } | ||
} | } | ||
Line 27: | Line 34: | ||
var child= sn[i]; | var child= sn[i]; | ||
if(child.nodeName == "SPAN") //subnode | if(child.nodeName == "SPAN") //subnode | ||
+ | { | ||
mnu_node(child, level+1, lastitem); | mnu_node(child, level+1, lastitem); | ||
+ | lastitem= undefined; | ||
+ | } | ||
else if(child.nodeName == "A") //link | else if(child.nodeName == "A") //link | ||
{ | { | ||
lastitem= child; | lastitem= child; | ||
- | + | child.ps_parent= parent; | |
} | } | ||
} | } | ||
Line 47: | Line 57: | ||
<div id="psmenu"> | <div id="psmenu"> | ||
- | <a | + | <a id="psmenu.lien1" href="lein1">lien1</a> |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
</div> | </div> | ||
</html> | </html> |
Revision as of 23:26, 23 July 2013