Template:INSA-Lyon/menuA
From 2011.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
+ | function afficheMenu(obj){ | ||
+ | |||
+ | var idMenu = obj.id; | ||
+ | var idSousMenu = 'sous' + idMenu; | ||
+ | var sousMenu = document.getElementById(idSousMenu); | ||
+ | |||
+ | /*****************************************************/ | ||
+ | /** si le sous-menu correspondant au menu cliqué **/ | ||
+ | /** est caché alors on l'affiche, sinon on le cache **/ | ||
+ | /*****************************************************/ | ||
+ | if(sousMenu.style.display == "none"){ | ||
+ | sousMenu.style.display = "block"; | ||
+ | } | ||
+ | else{ | ||
+ | sousMenu.style.display = "none"; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
<html> | <html> | ||
Line 58: | Line 77: | ||
- | #menu ul.niveau1 li.sousmenu: | + | #menu ul.niveau1 li.sousmenu:active ul.niveau2 { |
display:block; | display:block; | ||
} | } | ||
Line 68: | Line 87: | ||
</style> | </style> | ||
- | <div id="menu"> | + | <div id="menu" onclick="afficheMenu(this)"> |
<ul class="niveau1"> | <ul class="niveau1"> | ||
<li><a href="/Team:Lyon-INSA-ENS" title="go to home">Home</a></li> | <li><a href="/Team:Lyon-INSA-ENS" title="go to home">Home</a></li> |
Revision as of 13:33, 9 May 2011
function afficheMenu(obj){
var idMenu = obj.id; var idSousMenu = 'sous' + idMenu; var sousMenu = document.getElementById(idSousMenu);
/*****************************************************/ /** si le sous-menu correspondant au menu cliqué **/ /** est caché alors on l'affiche, sinon on le cache **/ /*****************************************************/ if(sousMenu.style.display == "none"){ sousMenu.style.display = "block"; } else{ sousMenu.style.display = "none"; }
}