incompatibilité sur mozilla ?
BOnjour,
je n'arrive pas a resoudre un probleme... cette fonction javascript marche à merveille sur IE ... et impossible à exécuter sur mozilla... je ne parviens pas à trouver le pourquoi du comment ... si qqn a une idée.... ? merci d'avance
si vous avez le temps pouvez vous jettez un coup d'oeil !! ?
voici ma fonction
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 50
|
function afficher(sec)
{
thisSec = eval('e' + sec);
if (thisSec != null){
if (thisSec.length){
if (thisSec[0].style.display != 'none'){
for (var i=0;i<thisSec.length;i++) {
thisSec[i].style.display = 'none';
document.getElementById('lien' + sec).innerHTML = 'Afficher';
}
}else{
for (var i=0;i<thisSec.length;i++) {
thisSec[i].style.display = 'inline-block';
document.getElementById('lien' + sec).innerHTML = 'Masquer';
}
}
}else{
if (thisSec.style.display != 'none'){
thisSec.style.display = 'none';
document.getElementById('lien' + sec).innerHTML = 'Afficher';
}else{
thisSec.style.display = 'inline-block';
document.getElementById('lien' + sec).innerHTML = 'Masquer';
}
}
}
}
voici le code HTML :
<table width="100%" cellpadding="10" cellspacing="2">
<tr>
<td><b>presentatio ?</b></td>
<td><a id="lien1" href="javascript:afficher(1);">Afficher</a></td>
</tr>
<tr id="e1" style="display:none;">
<td colspan="2">text</td>
</tr>
<tr>
<td><b>presentatio ?</b></td>
<td><a id="lien2" href="javascript:afficher(2);">Afficher</a></td>
</tr>
<tr id="e2" style="display:none;">
<td colspan="2">text</td>
</tr> |
marie
Re: incompatibilité sur mozilla ?
Citation:
Envoyé par mariedesmet
BOnjour,
je n'arrive pas a resoudre un probleme... cette fonction javascript marche à merveille sur IE ... et impossible à exécuter sur mozilla... je ne parviens pas à trouver le pourquoi du comment ... si qqn a une idée.... ? merci d'avance
Code:
1 2
|
thisSec = eval('e' + sec); |
C'est là que ça bugge. Pour mozilla (et pour moi aussi) eval(e1) ça fait null. Qu'est ce que tu aimerais que ça fasse?????