[JS + PHP] Replier un tableau
Bonsoir � tous,
je viens a vous car je suis un peu perdu ...
En rapidos, j'ai un menu fait avec des td et tr (html) pour mettre les images qui servent de contour etc ...
A un moment, j'insert le contenu du menu, pusi apr�s je referme tout.
Mon menu est divis� en 2. Une fonction open() pour le debut du tableau, et close() pour la fin du tableau
Ex :
open("test");
print "Mwhaha";
close();
Le contnu pr�cis de mes deux fonctions :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| function open($caption = "-", $align = "justify"){
global $THEME;
global $site_config;
print("<table class=\"NB-block\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td valign=\"top\" width=\"100%\">
<table class=\"NB-bhead\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"10\" height=\"24\" class=\"NB-btl\"><img src=\"".$site_config['SITEURL']."/themes/NB-TSpy/images/blank.gif\" style=\"display: block;\" height=\"24\" width=\"10\"></td>
<td width=\"100%\" height=\"24\" class=\"NB-btms\" onclick=\"affCache('$caption');\">$caption</td>
<td width=\"9\" height=\"24\" class=\"NB-btr\"><img src=\"".$site_config['SITEURL']."/themes/NB-TSpy/images/blank.gif\" style=\"display: block;\" height=\"24\" width=\"9\"></td>
</tr>
</table>
<table class=\"NB-bbody\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"5\" class=\"NB-bml\"><img src=\"".$site_config['SITEURL']."/themes/NB-TSpy/images/blank.gif\" style=\"display: block;\" height=\"2\" width=\"5\"></td>
<td valign=\"top\" class=\"NB-bmm\"><div id=$caption>");
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| function close(){
global $THEME;
global $site_config;
print("</div></td>
<td width=\"5\" class=\"NB-bmr\"><img src=\"".$site_config['SITEURL']."/themes/NB-TSpy/images/blank.gif\" style=\"display: block;\" height=\"2\" width=\"5\"></td>
</tr>
</table>
<table class=\"NB-bfoot\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"11\" height=\"9\" class=\"NB-bbl\"><img src=\"".$site_config['SITEURL']."/themes/NB-TSpy/images/blank.gif\" style=\"display: block;\" height=\"9\" width=\"11\"></td>
<td width=\"100%\" height=\"9\" class=\"NB-bbm\"><img src=\"".$site_config['SITEURL']."/themes/NB-TSpy/images/blank.gif\" style=\"display: block;\" height=\"9\" width=\"100%\"></td>
<td width=\"9\" height=\"9\" class=\"NB-bbr\"><img src=\"".$site_config['SITEURL']."/themes/NB-TSpy/images/blank.gif\" style=\"display: block;\" height=\"9\" width=\"9\"></td>
</tr>
</table></td>
</tr>
</table>
<BR>");
} |
Code JS pour plier :
Citation:
function affCache(idDiv) {
var div = document.getElementById(idDiv);
if (div.style.display == "")
div.style.display = "none";
else
div.style.display = "";
}
(merci � mathieu
Lorsque je clique sur le nom du "menu" j'aimerai que ce que contient celui-ci ce r�duise ou alors se d�plie et surtout qu'il reste si on change de page. Car pour deplier et plier j'y arrive.
Auriez vous une petite id�e ? :)
J'avais pens� � un cookie ...
Cordialement