innerHTML ne fonctionnant pas avec IE
Bonsoir,
J'ai un table qui contient plusieurs tbody.
Un de ces tbody a l'id "co_author"
Code:
<tbody id="co_author">
Dans ce Tobdy, j'aimerais insérer 3 zones de textes, j'appelle donc sur le clic d'un bouton une fonction nommée Add_Co_Author.
Code:
<td><input type="button" value="Add CO-AUTHOR" onClick="Add_Co_Author();"></td>
Voici le code de ma fonction :
Code:
1 2 3 4 5 6 7 8 9
| function Add_Co_Author()
{
if(global_numero_auteur < 13)
{
document.getElementById('co_author').innerHTML+= '<tr><td class="important">CO-AUTHOR '+global_numero_auteur+'</td></tr><tr><td>FIRST NAME<span class="asterix">*</span></td><td align="left"><input type="text" size="50"></td></tr><tr><td>LAST NAME<span class="asterix">*</span></td><td align="left"><input type="text" size="50"></td></tr><tr><td>INSTITUTION/AFFILIATION<span class="asterix">*</span></td><td align="left"><input type="text" size="50" onfocus="this.style.backgroundColor=\'yellow\'" onblur="this.style.backgroundColor=\'white\'"></td></tr>';
}
global_numero_auteur+=1;
} |
J'arrive dans la fonction, global_numero_auteur vaut 4 quand j'arrive dans la fonction (je l'ai vérifié par une alerte).
Le problème doit venir du innerHTML.
Auriez-vous une autre solution fonctionnant avec IE ?
Edit :
J'ai aussi testé ceci mais sans succès :
Code:
1 2 3 4 5 6 7 8 9 10 11
| function Add_Co_Author()
{
contenu_precedent = new String(document.getElementById('co_author').innerHTML);
//alert(global_numero_auteur);
if(global_numero_auteur < 13)
{
document.getElementById('co_author').innerHTML = contenu_precedent.concat('<tr><td class="important">CO-AUTHOR '+global_numero_auteur+'</td></tr><tr><td>FIRST NAME<span class="asterix">*</span></td><td align="left"><input type="text" size="50"></td></tr><tr><td>LAST NAME<span class="asterix">*</span></td><td align="left"><input type="text" size="50"></td></tr><tr><td>INSTITUTION/AFFILIATION<span class="asterix">*</span></td><td align="left"><input type="text" size="50" onfocus="this.style.backgroundColor=\'yellow\'" onblur="this.style.backgroundColor=\'white\'"></td></tr>');
}
global_numero_auteur= global_numero_auteur+1;
} |
En tout cas, avec Firefox, cela fonctionne parfaitement.
Merci d'avance.
beegees