Variable not defined alors que ça fonctionnait avant !
Cette question que j'avais posée naguère était résolue mais après je ne sais quelle modification, ça ne fonctionne plus ! :cry:
Voici le Javascript :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| /**
* masquerTousCommentaires
* Masque tous les commentaires aux messages affichés dans la page
*/
function masquerTousCommentaires(langue)
{
alert($("#blocMessage20 .bar_links #linkAfficheComm20").html());
$(".divMessage").each(function()
{
if($(".blocMessage .bar_links .linkAfficheComm", $(this)).html() !== null)
{
var obj = $(".blocMessage .bar_links .linkAfficheComm", $(this)); // lien à modifier
var inithtm = obj.html(); // contenu complet du lien
var initfct = obj.attr("href"); // cible du lien
var texte = '';
var nbcomm = $(".divComments input", $(this)).val();
if(langue == 'fr')
{
texte = 'commentaire';
}
else if (langue == 'es')
{
texte = 'comentario';
}
else if (langue == 'en')
{
texte = 'comment';
}
if(nbcomm > 1)
{
texte = texte + 's';
}
obj.attr("href",initfct.replace(/masque/i, "affiche"));
obj.html(inithtm.replace(obj.text(), nbcomm + ' ' + texte));
$(".divComments", $(this)).empty();
$(".divComments", $(this)).hide();
$("#comm_form", $(this)).empty();
$("#comm_form", $(this)).hide();
}
});
$("#menumasque").empty();
$("#td_menu_sup").attr("width", "0");
$("#cpt_comm").val("0");
} |
Le alert en début de fonction m'affiche bien ceci :
Code:
1 2 3
| <img src="images/btn_bubble.png" align="absmiddle" height="25px" width="25px">
<span class="nbreponses" title="Nombre de réponses">
2 </span> |
Mais Firebug me dit que ce qui coince est :
Citation:
inithtm is not defined
obj est bien valorisé puisque un alert(initfct); me donne bien son contenu.
Une idée à me soumettre pour débuguer ça ?