All pastes #707891 Raw Edit

Untitled

public text v1 · immutable
#707891 ·published 2007-09-23 11:38 UTC
rendered paste body
// chaque ligne de hidden indique si l'objet associé est caché ou non, pour pouvoir l'afficher/le cacher au moment où il faut
var hidden = new Array();

// articleid est le numéro du bloc que l'on veut cacher
function show_comments(articleid)
{
// on garde en main les objets que l'on compte cacher/afficher, c'est plus clair :)
 var comments=document.getElementById("comments" + articleid);
 var commentpost=document.getElementById("commentpost" + articleid);
// si notre objet à cacher est déja caché, on l'affiche alors!
 if (hidden[articleid])
 {
  comments.style.display = "block";
  commentpost.style.display = "block";
 }
// sinon on le cache
 else
 {
  comments.style.display = "none";
  commentpost.style.display = "none";
 }
}